Can a print overwrite a previous print ?

Sir Real nomail at adres.net
Fri May 8 10:36:22 EDT 2020


On Fri, 8 May 2020 16:25:52 +0200, ast <ast at invalid> wrote:

>Hello
>
>
>Suppose we want that:
>
>print("abcdef"); print("ghi")
>
>produces:
>
>ghidef
>
>The 2nd print overwrites the first one.
>Is it feasible ?
>
>It should since the progress bar tdqh seems to do that
>
>try:
>
>from tkdm import tkdm
>
>for i in tqdm(range(100_000_000)):
>     pass
>
>It produces a progress bar like this:
>100%|???????????????????????????????????????????????????????????????| 
>100000000/100000000 [00:56<00:00, 1781611.52it/s]


print('abcdef', end='\r'); print('ghi', end='')



More information about the Python-list mailing list