Skip to content

Instantly share code, notes, and snippets.

@Keiku
Created February 17, 2017 05:49
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 Keiku/5940f9bfcd17a34b950222eafafd29b7 to your computer and use it in GitHub Desktop.
Save Keiku/5940f9bfcd17a34b950222eafafd29b7 to your computer and use it in GitHub Desktop.
Print progress bar.
import time
from tqdm import tqdm
pbar = tqdm(["1", "2", "3", "4", "5"])
for char in pbar:
pbar.set_description("Processing %s" % char)
time.sleep(1)
# 0%| | 0/5 [00:00<?, ?it/s]
# Processing 1: 20%|██████▏ | 1/5 [00:01<00:04, 1.00s/it]
# Processing 2: 40%|████████████▍ | 2/5 [00:02<00:03, 1.00s/it]
# Processing 3: 60%|██████████████████▌ | 3/5 [00:03<00:02, 1.00s/it]
# Processing 4: 80%|████████████████████████▊ | 4/5 [00:04<00:01, 1.00s/it]
# Processing 5: 100%|███████████████████████████████| 5/5 [00:05<00:00, 1.00s/it]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment