responseMp3 = requests.get(url)
if responseMp3.status_code == 200:
with open("%s.mp3" % name, "wb") as code:
code.write(responseMp3.content)
print("下载完成")
else:
print('aidUrl请求返回错误,错误码为: %d' % responseMp3.status_code)
responseMp3 = requests.get(url)
if responseMp3.status_code == 200:
with open("%s.mp3" % name, "wb") as code:
code.write(responseMp3.content)
print("下载完成")
else:
print('aidUrl请求返回错误,错误码为: %d' % responseMp3.status_code)
本文标题:python 利用requests来下载文件
本文链接:https://www.haomeiwen.com/subject/dpubvttx.html
网友评论