How do I print information in the same place as the previous information?

-2

I wanted to know a command in which I could update the screen and the new information would appear in the same place, just like a "loading" bar that when increasing does not create a copy at the bottom but updates in the same position.     

asked by anonymous 09.06.2018 / 20:31

1 answer

0

To make a load bar, install and use tqdm .

In the command window (cmd) or terminal emulator:

pip install tqdm

Code:

from tqdm import tqdm
import time

for i in tqdm(range(100)):
    # Seu código de iteração aqui.
    # O tqdm pode ser usado em qualquer iterador.
    # Aqui só damos um time.sleep pra simular carga.
    time.sleep(0.1)
    
09.06.2018 / 20:38