We are creating a simple console application that uploads/downloads files to an FTP server via ftplib.
When uploading/downloading data, I want to show you how much buffering has progressed, but if you print it out one line at a time,
*
**
***
(When *
is in progress) The previous buffering record remains like this. <
\r
moves the cursor to the beginning of the line.
#Code increments by 1% every 1 second
import time
import sys
for i in range(100):
time.sleep(1)
sys.stdout.write("\r%d%%" % i)
sys.stdout.flush()
© 2024 OneMinuteCode. All rights reserved.