python下载文件

获取网页地址,下载到本地文件夹

import requests
import code
url = "http://data.5sing.kgimg.com/G140/M04/06/13/zA0DAFurVAuAdpq3AI0OnoTrpZU650.mp3";
print ("downloading with urllib")
r = requests.get(url)
with open("a.mp3","wb") as code:
    code.write(r.content)
print("download OK")
    

 

posted @ 2018-10-10 17:18  菜の可怜  阅读(206)  评论(0编辑  收藏  举报