Created
January 27, 2015 11:58
-
-
Save astagi/45976ef20f3f729daad3 to your computer and use it in GitHub Desktop.
Show progress in console with Python Add new snippet
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 show_progress(actual, total): | |
percentage = actual / float(total) | |
done = int(50 * percentage) | |
sys.stdout.write("\r[%s%s] %d %%" % ('=' * done, ' ' * (50-done), percentage * 100)) | |
sys.stdout.flush() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment