Created
May 13, 2022 12:49
-
-
Save m3hrdadfi/35ac82fd4b067f4030ac441168759919 to your computer and use it in GitHub Desktop.
Progress bar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tqdm | |
import time | |
# with number of iterations | |
n = 10 | |
pbar = tqdm.tqdm(total=n) | |
for t in range(n): | |
pbar.set_description(f'Your information is chaning {t+1}') | |
# do some computation | |
time.sleep(0.1) | |
pbar.update(1) | |
# without number of iterations | |
pbar = tqdm.tqdm() | |
for t in range(n): | |
if t > n: | |
break | |
pbar.set_description(f'Your information is chaning {t+1}') | |
# do some computation | |
time.sleep(0.1) | |
pbar.update(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment