Created
November 6, 2015 10:14
-
-
Save ab9-er/843d1af20049e72e2016 to your computer and use it in GitHub Desktop.
ProgressIndicator
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 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