xxxxxxxxxx
import time
for j in range(1,5):
print('waiting : '+j, end='\r')
time.sleep(1)
xxxxxxxxxx
# in order to make the line in a print statement
#in your python terminal rewrite on the same line
print('hello', end='\r')
#just like the command \n makes a new line \r restarts that line.
xxxxxxxxxx
## the command \r does this
print('hello', end='\r')
print('bye', end='\r') ## the \r command is what does this.
output:
bye
## it is bye because it immediately rewrites the line with bye.