清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
演示从指定url下载一个mp3文件,并在下载过程中显示出下载进度百分比#encoding=utf-8 import urllib import sys def cbk(a,b,c): per = 100.0*a*b/c if per >100: per=100 def cls(str): return '\r'*len(str) out='%.2f%%'%per sys.stdout.write(u'下载进度:') sys.stdout.write(out) sys.stdout.write(cls(out)) url="http://96.ierge.cn/11/168/336613.mp3" urllib.urlretrieve(url,'download_123.mp3',cbk)