Created
January 13, 2016 21:35
-
-
Save ducu/45247abf1662fdb50ecf to your computer and use it in GitHub Desktop.
Progress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, time | |
def chunks(l, n): | |
c = len(l) | |
for i in xrange(0, c, n): | |
sys.stdout.write("\r%d%%" % (min(i+n,c)*100/c,)) | |
sys.stdout.flush() | |
yield l[i:i+n] | |
for chunk in chunks(range(100), 10): | |
time.sleep(1) | |
print '' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment