This question is not duplicated, the linked and question not solve the problem, i'm trying print two lines at same position (each print in one row without new lines inside the loop), the linked question show how print just one line in the same position....
can be easy print one line in the same position inside a loop using python:
from time import sleep
for i in range(50):
sleep(0.1)
print("hi"+str(i) , end="\r")
But how I can do it using two lines inside the loop?
I tried:
from time import sleep
for i in range(50):
sleep(0.1)
print("hi"+str(i) , end="\r")
print("hi2"+str(i) , end="\r")
It does not work :-(
I try (without the first \r
):
print("hi"+str(i) , end="")
print("hi2"+str(i) , end="\r")
Not works too, this print hi
and hi2
in the same line...
There are some way to print hi and hi2(each in a row) keeping the position line?
the expected result would be::
hi<increment from 0 to 50 without new line jump inside the loop>
hi2<increment from 0 to 50 without new line jump inside the loop>