Skip to navigation
How to get download progress with python
07.12.13
import sys, urllib def reporthook(a,b,c): # ',' at the end of the line is important! print "% 3.1f%% of %d bytes\r" % (min(100, float(a * b) / c * 100), c), #you can also use sys.stdout.write #sys.stdout.write("\r% 3.1f%% of %d bytes" # % (min(100, float(a * b) / c * 100), c) sys.stdout.flush() for url in sys.argv[1:]: i = url.rfind('/') file = url[i+1:] print url, "->", file urllib.urlretrieve(url, file, reporthook) http://stackoverflow.com/questions/974741/wget-vs-urlretrieve-of-python
Reply
Anonymous
Information Epoch 1732508694
Live free or die.
Home
Notebook
Contact us