python下载网络图片文件到本地
python下载网络图片文件到本地
import urllib.request
rsp=urllib.request.urlopen(“http://n.sinaimg.cn/ent/transform/w630h933/20171222/o111-fypvuqf1838418.jpg”)
img=rsp.read()
with open(‘1.jpg’,‘wb’) as f:
f.write(img)
import urllib.request
rsp=urllib.request.urlopen(“http://n.sinaimg.cn/ent/transform/w630h933/20171222/o111-fypvuqf1838418.jpg”)
img=rsp.read()
with open(‘1.jpg’,‘wb’) as f:
f.write(img)
相关推荐