ITeye博客

python urllib模块显示下载进度

xfcode · 2014-01-18 07:32 · linux · 编程语言 · Markdown

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%
...

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。