I would like to print the numbers from 1 to 100 to the terminal with print
. But I want only one number to be displayed which is steadily incremented.
I know that I can print in the same line by putting a ,
behind the print
statement, but I want to clear the line and print to it again. How can I do this?
Okay, I tried to solve it like here by adding end='\r'
from __future__ import print_function
import time
for x in range(100):
print(str(x), end='\r')
time.sleep(0.1)
but that just does nothing.