[Python] How to remove tqdm progress bar in jupyter notebook once the loop breaks?

Discussão em 'Python' iniciado por Stack, Julho 19, 2025.

  1. Stack

    Stack Membro Participativo

    I have tried the following methods

    • Set leave=False or disable=True
    • tqdm_iterator.close()

    but they cannot remove the broken progress bar.

    from tqdm.notebook import tqdm
    tqdm_iterator = tqdm(range(10000), leave=False)
    for i in tqdm_iterator:
    time.sleep(0.0001)
    if i>8000:
    tqdm_iterator.n = 10000
    break


    broken progress bar

    Continue reading...

Compartilhe esta Página