Print On The Same Line With Python
1 min read

Printing on the same with Python is not that difficult, it did, however, take some time before I managed to find the best way to do it myself. This is a neat little trick and I tend to use it quite a lot in my programs.

print("hello", end="\r", flush=True)


I have written a quick example, with the following code:

import time

for i in range(10):
    print(i, end="\r", flush=True)

It looks like this.

Flush python