Python simple script batch query spider true love Shanghai

Python the use is very convenient, recently wrote a lot of little things, is to share with you. This is a simple query and spider love Shanghai.

 The

love python, Shanghai dragon students can pay attention to my personal blog 贵族宝贝 472779600 QQ group, Shanghai dragon.Pythonhk贵族宝贝

#

print IP, ‘to find the server’

spiderip = open (‘spiderip.txt’,’r’)

for IP in spiderip:

else:

QQ 20160128180922

To determine the type of IP

print IP, ‘fake spider’

try:

print IP, ‘the love of spiders in Shanghai’

# open storage love Shanghai spider IP file

coding: cp936 -*-

if’baiduspider’in result[0]:

import sys, socket

result = socket.gethostbyaddr (IP)

IP = ip.strip (‘n’)

.

except socket.herror, e:

# -*-

Leave a Reply

Your email address will not be published. Required fields are marked *