The module tqdm lets you create a progress bar. This lets you make nice progress bars:
The developer thought it's a good name. It is an abbreviation for "I love you so much" in Spanish (te quiero demasiado).
Instantly make your loops show a smart progress meter - just wrap any iterable with tqdm(iterable), and you're done!
from tqdm import tqdm for i in tqdm(range(10000)): ...
76%|████████████████████████████ | 7568/10000 [00:33<00:10, 229.00it/s]
The code below creates several threads.
You see, it can be used both on the current thread and with several threads.
#!/usr/bin/python3 import time import tqdm def work1(): time.sleep(1) def work2(): time.sleep(1) def work3(): time.sleep(1) def work4(): time.sleep(1) def work5(): time.sleep(1) def work6(): time.sleep(1) def worker(): work_set = [work1, work2, work3, work4, work5, work6] return work_set def main(): a = worker() for i in tqdm.tqdm(range(6)): b = a[i]() if __name__ == '__main__': main()
100%|████████████████████████████████████| 6/6 [00:06<00:00, 1.00s/it]