Skip to content

Instantly share code, notes, and snippets.

@ab9-er
Created November 6, 2015 10:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ab9-er/843d1af20049e72e2016 to your computer and use it in GitHub Desktop.
Save ab9-er/843d1af20049e72e2016 to your computer and use it in GitHub Desktop.
ProgressIndicator
import time
import sys
def progress(*args, **kwargs):
# Process relevant args and kwargs to suit the application
for i in range(101):
time.sleep(0.1)
sys.stdout.write("\r%d%%" % i)
percent = float(i)/100
hashes = '#' * int(percent * 50)
spaces = '-' * (50 - len(hashes))
sys.stdout.write("\rPercent: [{0}] {1}%".format(hashes + spaces, int(percent * 100)))
sys.stdout.flush()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment