1

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

Daniel kim
  • 158
  • 1
  • 13

1 Answers1

0

is this what you want ..

for i in range(10):
    time.sleep(1)
    print("AAAAA\n\n")
    time.sleep(2)
    print("BBBBB\n\n")
caldera.sac
  • 4,918
  • 7
  • 37
  • 69