Keiku
2/17/2017 - 5:49 AM

Print progress bar.

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]