Created
September 10, 2015 18:45
-
-
Save VincentLoy/73d42c84811fed67cc38 to your computer and use it in GitHub Desktop.
Nice Python progress bar
This file contains 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 sys | |
def progress(count, total, suffix=''): | |
bar_len = 50 | |
filled_len = int(round(bar_len * count / float(total))) | |
percents = round(100.0 * count / float(total), 1) | |
bar = '█' * filled_len + '▓' * (bar_len - filled_len) | |
sys.stdout.write('==> {} {}{} ... {}'.format(bar, percents, '%', suffix), ending='\r') | |
sys.stdout.flush() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment