-
-
Save zwehrwein/9a9d6d708b14cc7a90016ffeb2212bac to your computer and use it in GitHub Desktop.
A python function that can be used to print an ongoing 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 print_progess(currentProgress, maxProgress, numberDashes, message = ""): | |
progress = numberDashes * (currentProgress / maxProgress) + 1; | |
dashes = "=" * int(progress) + "> " | |
percentage = int(100 * currentProgress / maxProgress) + 1; | |
if percentage > 100: | |
percentage = 100; | |
sys.stdout.write("\r " + "<" + message + "> " + dashes + "{0:.2f}".format(percentage) + "%"); | |
sys.stdout.flush(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment