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()
