---
title: "python urllib模块显示下载进度"
author: "xfcode"
date: "2014-01-18T07:32:26Z"
tags: []
categories: ["编程语言"]
slug: "python-urllib"
draft: false
lastmod: "2014-01-18T07:32:26Z"
id: 2006495
url: "https://xfcode.iteye.com/blog/2006495"
---

python的urllib模块显示下载进度.

 
```java
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%
...
```