[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分


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM