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

Asked

Viewed 19 times

-2

I wanted to know a command where I could update the screen and the new information appear in the same place, like a "loading" bar that when it increases does not create a copy below but updates in the same position.

1 answer

0

To make a load bar, install and use the 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)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.