Skip to content

Instantly share code, notes, and snippets.

@timothymugayi
Created December 1, 2019 02:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timothymugayi/ab52214fa0a131526a0f3abe837e582a to your computer and use it in GitHub Desktop.
Save timothymugayi/ab52214fa0a131526a0f3abe837e582a to your computer and use it in GitHub Desktop.
tqdm update progress bar manually
import time
import sys
from tqdm import tqdm
def do_something():
time.sleep(1)
with tqdm(total=100, file=sys.stdout) as pbar:
for i in range(10):
do_something()
# Manually update the progress bar, useful for streams such as reading files.
pbar.update(10)
# Updates in increments of 10 stops at 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment