Python 图片下载

 

import requests

# 原文:https://blog.csdn.net/z564359805/article/details/81978913

arr = ["https://img.yzcdn.cn/upload_files/2018/01/02/FiF5PVWUnEa7WvY9XrZ7sTS0oos_.jpg!large.jpg", "https://img.yzcdn.cn/upload_files/2018/01/02/FkWnmjXC0SW5Wnxpu-k5oqOyGTxE.jpg!large.jpg", "https://img.yzcdn.cn/upload_files/2017/08/30/150407378283543361.jpg!large.jpg", "https://img.yzcdn.cn/upload_files/2017/08/30/150407378330677125.jpg!large.jpg", "https://img.yzcdn.cn/upload_files/2017/08/30/150407378404625301.jpg!large.jpg"]

i=0
for inx, val in enumerate(arr):
    html = requests.get(val)
    with open("C:/data/"+str(inx)+".jpg","wb")as f:
        f.write(html.content)

 

posted @ 2020-02-01 16:27  古兴越  阅读(150)  评论(0编辑  收藏  举报