I was disappointed with the code highlights in Qiita, so I wrote it in Gist. https://gist.github.com/tyochiai/8817420
It's a terrible sample, but when I googled "Python download progress", for some reason I only got a sample that uses sys.stdout.write ()
(probably there is a source somewhere). ) Separately, it is a sample that print ()
can be used.
If you pass a function to the argument reporthook
, ʻurlretrieve ()` will call it by passing the current number of blocks, block size, and total download size to the argument every time you download one block.
By the way, it's ʻurlretrieve () `, but the documentation says that it's classified as a legacy interface and may disappear soon (in fact, some methods have been deprecated in 3.3). At that time, will an alternative method be prepared?
Recommended Posts