python 利用requests来下载文件

2016-12-31  本文已影响339人  Ugly_K
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)
上一篇 下一篇

猜你喜欢

热点阅读