How to display the content slowly when using the print function without breaking line?

Asked

Viewed 38 times

2

PYTHON 3

import time
for i in range (1, 11):
    time.sleep(1)
    print (i)

RESULT: Screen output every second.

Based on the above instructions, every time the condition is true a result will be printed on the screen every second. So far so good.

But when I use end="", the loop only prints my result when the condition is no longer true, that is, it does not print every second and yes, only when it ends.

import time
for i in range (1, 11):
    time.sleep(1)
    print (i, end=" ")

RESULT: Screen output only at the end of the loop.

MORAL OF THE QUESTION: How could I print a result EVERY SECOND without line break?

  • 1

    I’m new in the business, also did not know about the FLUSH, therefore justifies the duplicate rsrs. Thanks to those who directed me to the link because solved my question :)

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.