Skip to content

Instantly share code, notes, and snippets.

@nnarain
Created March 8, 2016 01:34
Show Gist options
  • Save nnarain/1ed67ff265bd046630f1 to your computer and use it in GitHub Desktop.
Save nnarain/1ed67ff265bd046630f1 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import time
import sys
width = 50
def displayProgress(progress):
bar = int(progress * width)
sys.stdout.write("\r[%s%s] %.2f%%" % (("=" * bar), (" " * (width - bar)), progress * 100) )
sys.stdout.flush()
total = 100
for i in range(total):
time.sleep(0.1)
progress = (float(i)/ float(total))
displayProgress(progress)
print "\n\nDone"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment