Skip to content

Instantly share code, notes, and snippets.

@VincentLoy
Created September 10, 2015 18:45
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 VincentLoy/73d42c84811fed67cc38 to your computer and use it in GitHub Desktop.
Save VincentLoy/73d42c84811fed67cc38 to your computer and use it in GitHub Desktop.
Nice Python progress bar
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