Created
December 12, 2015 22:08
-
-
Save erikcox/6432f87ca76eb7dee9ee to your computer and use it in GitHub Desktop.
Progress bar function in Python
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
def update_progress(progress): | |
print '\r{1}%[{0}] '.format('#' * (progress/2), str(progress).zfill(2)), | |
# Useage | |
data = [] | |
count = 0.0 | |
total = len(data) | |
print 'Starting...' | |
# iterate over something and update count | |
for i in data | |
... | |
update_progress(int((count/total)*100)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment