Created
October 1, 2018 11:08
-
-
Save DavidFricker/86914cbaa165d916c648d676d36b77d9 to your computer and use it in GitHub Desktop.
Displays progress in 1% steps with a big loading bar
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 sys | |
| def print_loading_bar(complete, total): | |
| complete_percentage = round((complete/total * 100), 2) | |
| if complete_percentage % 1 == 0: | |
| loading_bar = (['='] * int(complete_percentage)) + (['>']) + (['-'] * (100 - 1 - int(complete_percentage))) | |
| sys.stdout.write("\r" + str(complete_percentage) + "%: "+ ''.join(loading_bar)) | |
| sys.stdout.flush() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment