Created
March 18, 2020 12:52
-
-
Save yulkang/40168c7729a7a7b96d0116d8b1bc26df to your computer and use it in GitHub Desktop.
Writing output on the same line multiple times in the console
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
# On PyCharm Debugger console, \r needs to come before the text. | |
# Otherwise, the text may not appear at all, or appear inconsistently. | |
# tested on PyCharm 2019.3, Python 3.6 | |
# Modification of https://stackoverflow.com/a/517523/2565317 | |
import time | |
print('Start.') | |
for i in range(100): | |
time.sleep(0.02) | |
print('\rDownloading File FooFile.txt [%d%%]'%i, end="") | |
print('\nDone.') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment