代码如下:
def saveWebPicture(url,path): header = {"Connection":"Keep-Alive", "Accept":"image/png,image/*;q=0.8,*/*;q=0.5", "Accept-Encoding":"gzip, deflate, sdch", "Accept-Language":"zh-CN,zh;q=0.8"} conn=urllib2.Request(url,headers=header) conn=urllib2.urlopen(conn) f=open(path,'wb') f.write(conn.read()) f.close()
下下来的图片如下(只下载了一半):
等待一下再发送请求就好了。。。。