Quote from
carbonkid on 4 January 2024, 14:14
Hello, when I print the following countdown timer in the Python console, it writes to a new line every second, despite the fact that I have formatted the print statement with \r. Is it intentional that no line should be overwritten in the Python console or is it something else? It is the countdown timer for my spindle warm-up.
#Definition countdown timer
def countdown(minutes):
seconds = minutes * 60
while seconds > 0:
mins, secs = divmod(seconds, 60)
timer = '{:02d}:{:02d}'.format(mins, secs)
print(timer, end="\r")
time.sleep(1)
seconds -= 1
Hello, when I print the following countdown timer in the Python console, it writes to a new line every second, despite the fact that I have formatted the print statement with \r. Is it intentional that no line should be overwritten in the Python console or is it something else? It is the countdown timer for my spindle warm-up.
#Definition countdown timer
def countdown(minutes):
seconds = minutes * 60
while seconds > 0:
mins, secs = divmod(seconds, 60)
timer = '{:02d}:{:02d}'.format(mins, secs)
print(timer, end="\r")
time.sleep(1)
seconds -= 1
Uploaded files: