Python print output delay

Asked 1 years ago, Updated 1 years ago, 130 views

print('A',end="")

time.sleep(1)

print('B',end="")

time.sleep(1)

print('C')

time.sleep(1)

print('D')

I was expecting ABCD to print out in a second, but... There is no delay unless end='\n'.

What are some ways?

python print sleep

2022-09-22 18:35

1 Answers

I tried it just in case... I can't believe this... It works the way you want it to...

import time

print('A',end="",flush=True)
time.sleep(1)
print('B',end="",flush=True)
time.sleep(1)
print('C',end="",flush=True)
time.sleep(1)
print('D',end="",flush=True)


2022-09-22 18:35

If you have any answers or tips

Popular Tags
python x 4647
android x 1593
java x 1494
javascript x 1427
c x 927
c++ x 878
ruby-on-rails x 696
php x 692
python3 x 685
html x 656

© 2024 OneMinuteCode. All rights reserved.