import requests url = 'https://www.python.org/ftp/python/3.8.1/python-3.8.1.exe' resp = requests.get(url) with open('C:\\Users\\del\\Desktop\\新建文件夹\\2.exe','wb') as f: f.write(resp.content)
执行结果:
下载成功,说明此文件下载成功
import requests url = 'https://www.python.org/ftp/python/3.8.1/python-3.8.1.exe' resp = requests.get(url) with open('C:\\Users\\del\\Desktop\\新建文件夹\\2.exe','wb') as f: f.write(resp.content)
执行结果:
下载成功,说明此文件下载成功