- #coding=utf-8
- import urllib
- import os
- def Schedule(a,b,c):
- '''
- a:已经下载的数据块
- b:数据块的大小
- c:远程文件的大小
- '''
- per=100.0*a*b/c
- if per>100:
- per=100
- print '%.2f% %'%per
- url = "http://dldir1.qq.com/qqfile/qq/QQ8.9/20026/QQ8.9.exe"
- local = os.path.join('','QQ8.9.exe')
- urllib.urlretrieve(url,local,Schedule)