How do I start from Side using end="" with the Time Module included

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

Well here is the Program. I would like to know how I can start the. Ex. During this time of 1 second ... when I do not use the end it works but printing down.

    
asked by anonymous 12.06.2018 / 00:04

1 answer

0

To continue printing on the same line as it happens, in addition to changing the end-of-line character with the end parameter, you must also pass the flush=True parameter to synchronize the file without the end of line being present:

import time
for i in range(0,10,+1):
    print(".", end="", flush=True)
    time.sleep(1)
    
12.06.2018 / 00:58