Skip to content

Instantly share code, notes, and snippets.

@m3hrdadfi
Created May 13, 2022 12:49
Show Gist options
  • Save m3hrdadfi/35ac82fd4b067f4030ac441168759919 to your computer and use it in GitHub Desktop.
Save m3hrdadfi/35ac82fd4b067f4030ac441168759919 to your computer and use it in GitHub Desktop.
Progress bar
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