import requests
path = "D:/abc/123.jpg" #设置图片文件路径,前提是必须要有abc这个文件夹
url = 'https://car3.autoimg.cn/cardfs/product/g24/M09/2C/2A/1024x0_1_q87_autohomecar__ChcCL1rd66CAbLHHAAvLMUvSlTU844.jpg'
r = requests.request('get',url) #获取网页
print(r.status_code)
with open(path,'wb') as f: #打开写入到path路径里-二进制文件,返回的句柄名为f
f.write(r.content) #往f里写入r对象的二进制文件
f.close()