Skip to content

Instantly share code, notes, and snippets.

@dnene
Created January 1, 2013 20:07
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 dnene/4429651 to your computer and use it in GitHub Desktop.
Save dnene/4429651 to your computer and use it in GitHub Desktop.
Progress Bars in Python 3.x
import time
import sys
def do_task():
time.sleep(0.1)
def example_1(n):
steps = n/10
for i in range(n):
do_task()
if i%steps == 0:
print('█', end=""),
sys.stdout.flush()
print ('] Done!')
print('Starting [ ]',end="")
print('\b'*12, end="")
sys.stdout.flush()
example_1(100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment