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()
相关文章
- pip --upgrade批量更新过期的python库
- Python 对目录中的文件进行批量转码(GBK>UTF8)
- 【Jquery EasyUI + Servlet】DataGrid,url请求带中文出现乱码的解决方案
- python之对指定目录文件夹的批量重命名
- python批量修改linux主机密码
- Python arcpy创建栅格、批量拼接栅格
- Python核对遥感影像批量下载情况的方法
- 使用python批量裁剪图片为目标大小
- python中发送post请求时,报错“Unrecognized token 'xxxx': was expecting ('true', 'false' or 'null')”
- get请求URL传值时中文乱码解决办法