python的urllib模块显示下载进度.
def report_hook(count, block_size, total_size):
... print '%02d%%'%(100.0 * count * block_size/ total_size)
...
urllib.urlretrieve("http://www.jbxue.com/", reporthook= report_hook)
00%
01%
03%
...
本文介绍如何使用Python的urllib模块来实现文件下载时的进度显示功能。通过定义一个回调函数report_hook并在urllib.urlretrieve中指定它作为reporthook参数,可以实时打印出下载进度的百分比。
5221

被折叠的 条评论
为什么被折叠?



