Dec-03-2018, 06:35 PM
Hello all,
I am new in Python coding, but I would like to ask for help. I need print data on same line and same position so values will be overwritten (for example counter of seconds)
I've had this code:
import time
for n in range(1, 6):
print(' time is 0.{}sec'.format(n), end='\r')
time.sleep(0.1)
but after runnig of code have all data on one line but they are not owerwritten.
time is 0.1sec time is 0.2sec time is 0.3sec time is 0.4sec time is 0.5sec
Can you help me where can be a problem?
I 've had Python 3.7.1 (Windows).
Thank you very much.
Marv
I am new in Python coding, but I would like to ask for help. I need print data on same line and same position so values will be overwritten (for example counter of seconds)
I've had this code:
import time
for n in range(1, 6):
print(' time is 0.{}sec'.format(n), end='\r')
time.sleep(0.1)
but after runnig of code have all data on one line but they are not owerwritten.
time is 0.1sec time is 0.2sec time is 0.3sec time is 0.4sec time is 0.5sec
Can you help me where can be a problem?
I 've had Python 3.7.1 (Windows).
Thank you very much.
Marv