首页 新闻 会员 周边

Python怎样才能下载完全的网络图片呀?

0
悬赏园豆:10 [已关闭问题] 关闭于 2015-12-23 16:24

代码如下:

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() 

下下来的图片如下(只下载了一半):

yuboan的主页 yuboan | 菜鸟二级 | 园豆:204
提问于:2015-12-23 13:51
< >
分享
所有回答(1)
0

等待一下再发送请求就好了。。。。

yuboan | 园豆:204 (菜鸟二级) | 2015-12-23 16:23
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册