通过链接下载图片:
def request_download():
import requests
r = requests.get(IMAGE_URL)
with open('./image/img2.png', 'wb') as f:
f.write(r.content)
某下载zip文件案例:
def get_write(self):
for index,i in enumerate(self.themes_zip_list):
zip_response = requests.get(i,headers = self.headers)
with open(str(self.moban_zipName_list[index])+".zip","wb") as f:
f.write(zip_response.content)
自定义下载路径:
with open("F:\\zip\\"+str(self.moban_zipName_list[index])+".zip","wb") as f: