Skip to content

Instantly share code, notes, and snippets.

@minichate
Created January 31, 2012 22:40
Show Gist options
  • Save minichate/1713533 to your computer and use it in GitHub Desktop.
Save minichate/1713533 to your computer and use it in GitHub Desktop.
Progress Bar
count = len(entries)
for i, entry in enumerate(entries):
percent = math.ceil(100 * float(i) / float(count))
marks = math.floor(70 * (percent / 100.0))
spaces = math.floor(70 - marks)
updated_loader = '[' + ('=' * int(marks)) + (' ' * int(spaces)) + ']'
if not loader == updated_loader or loader is None:
sys.stdout.flush()
sys.stdout.write(" Re-Keying: %s %d%%\r" % (updated_loader, percent))
loader = updated_loader
sys.stdout.write("\n")
sys.stdout.flush()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment