小小铺垫 | python 从网络上下载文件
函数作用:下载网络上的文件
参数
url:网址
代码:
from requests import get
from re import findall
import shutil
def downl(url):
res = get(url, stream = True)
nameFile = ''.join()
with get(url, stream=True) as response:
if response.status_code == 200:
with open(nameFile, mode = 'wb') as local_file:
shutil.copyfileobj(response.raw, local_file)
如果有帮助,别忘了评分{:10_281:} :
https://xxx.ilovefishc.com/album/202004/28/181031g6zrroq7uguod7qi.gif
页:
[1]