Skip to content

Instantly share code, notes, and snippets.

@blaylockbk
Created February 4, 2019 17:43
Show Gist options
  • Save blaylockbk/62353961963e5ad5f27dbb6cbb649a8f to your computer and use it in GitHub Desktop.
Save blaylockbk/62353961963e5ad5f27dbb6cbb649a8f to your computer and use it in GitHub Desktop.
Print progress to show completion of a loop
# Print a progress bar for a loop completion
from time import sleep
F = range(10)
num = len(F)
for i in F:
sleep(1)
sys.stdout.write('\r%.1f%% Complete (%s of %s)' % (i/num*100, i, num))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment