Skip to content

Instantly share code, notes, and snippets.

@erikcox
Created December 12, 2015 22:08
Show Gist options
  • Save erikcox/6432f87ca76eb7dee9ee to your computer and use it in GitHub Desktop.
Save erikcox/6432f87ca76eb7dee9ee to your computer and use it in GitHub Desktop.
Progress bar function in Python
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