import urllib2 from urllib import quote f = open("data.in", "r") out = file("data2.out","w+") a = 1.0 for line in f: #print line stri = quote(line) url =‘*******‘+stri #print url try: data = urllib2.urlopen(url) except: date = ‘error‘ no = str(a) out.writelines(no+‘ ‘+ data.read()) a = a+ 1 if (a%1000==0): print a #print data.read() f.close() out.close()
时间: 2024-10-12 03:00:09