I want to print multiple lines on console in place. Like this,
AAAAAA
BBBBBB
But, If I print above the strings using '\\r'
as below,
for i in range(10):
time.sleep(1)
print("AAAA\r", end='')
time.sleep(1)
print("BBBB\r", end='')
The final result is just like this
BBBB
What's happening is AAAA
-> BBBB
-> AAAA
-> BBBB
..... and it's not printing like this(IN PLACE!):
AAAA
BBBB
Not Like this
AAAA
BBBB
AAAA
BBBB
AAAA
BBBB
...
Is there any solution about this? Please help me
is this what you want ..
for i in range(10):
time.sleep(1)
print("AAAAA\n\n")
time.sleep(2)
print("BBBBB\n\n")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.