[python]下载网络文件到本地

下例中选择的是一张网络图片

例程:

#encoding=utf-8
import urllib.request

rsp=urllib.request.urlopen("https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=3315413812,3282006499&fm=26&gp=0.jpg")
img=rsp.read()
with open('xyyx.jpg','wb') as f:
    f.write(img)

2020年9月7日08点44分

posted @ 2020-09-07 08:44  不朽的飞翔  阅读(1206)  评论(0编辑  收藏  举报