Skip to content

Instantly share code, notes, and snippets.

@kvalle
Created November 21, 2012 22:14
Show Gist options
  • Save kvalle/4128215 to your computer and use it in GitHub Desktop.
Save kvalle/4128215 to your computer and use it in GitHub Desktop.
Demo of python "progress bar"
import time
import sys
total = int(sys.argv[1]) if len(sys.argv) > 1 else 100
def status_line(num, total):
line = "> processed %d of %d files" % (num, total)
sys.stdout.write(line)
sys.stdout.flush()
sys.stdout.write("\b" * (len(line)))
for num in xrange(total + 1):
time.sleep(0.1)
status_line(num, total)
sys.stdout.write("\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment