图片下载案例

import requests
def down_load(img_url,file_name):
    response=requests.get(img_url)
    img_data=response.content
    with open(file.name,'wb') as f:
        f.write(img_data)
down_load('http://www.baidu.com/img/bd_logol.png', 'baidu.png')

该代码能够下载百度官网logo

你可能感兴趣的:(python)