Skip to content

Instantly share code, notes, and snippets.

@velppa
Created April 12, 2013 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save velppa/5372611 to your computer and use it in GitHub Desktop.
Save velppa/5372611 to your computer and use it in GitHub Desktop.
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