Comment imprimer pour Loop dans la même ligne en Python
# A small example using range function
for i in range(1, 11):
print(i, end="")
Homely Hare
# A small example using range function
for i in range(1, 11):
print(i, end="")
import time
for j in range(1,5):
print('waiting : '+j, end='\r')
time.sleep(1)
# Python 2 only
print "Seven"
# Backwards compatible (also fastest)
import sys
sys.stdout.write("Nice film")
# Python 3 only
print("Mob Psycho 100", end="")
## 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.