【Python】批量下载图片

 

"""
-*- coding:utf-8 -*-
@Time   :2020/9/4 17:58
@Version:1.0
"""

import requests


def download(img_url, path, img_name):
    pic = requests.get(img_url, verify=False)
    fb = open(path + img_name, 'wb')
    fb.write(pic.content)


if __name__ == '__main__':
    url = 'https://img9.doubanio.com/view/photo/thumb/public/p917023389.jpg'
    path = './'
    img_name = '图片.jpg'
    download(url, path, img_name)

 

posted @ 2020-09-26 21:07  淡怀  阅读(287)  评论(0编辑  收藏  举报