Created
August 9, 2018 22:45
-
-
Save yoachim/6727c5501a3962a1247a9f69d99da043 to your computer and use it in GitHub Desktop.
Python print loop progress wihtout any extra dependencies
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 | |
max_i = int(10) | |
for i in range(max_i): | |
progress = i/float(max_i)*100 | |
text = "\rprogress = %.1f%%"%progress | |
sys.stdout.write(text) | |
sys.stdout.flush() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment