Created
January 1, 2013 20:07
-
-
Save dnene/4429651 to your computer and use it in GitHub Desktop.
Progress Bars in Python 3.x
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 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