Created
April 12, 2013 14:54
-
-
Save velppa/5372611 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 sys | |
class ProgressBar(): | |
def __init__(self, num_steps): | |
self.num_steps = num_steps | |
def progress(self, step): | |
i = int(100.0 * step / self.num_steps) | |
sys.stdout.write("\rProgress: [{0:100s}] {1:d}%".format('=' * i, i)) | |
sys.stdout.flush() | |
if i == 100: | |
sys.stdout.write("\n") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment