from tqdm import tqdm import time for i in tqdm(range(5)): time.sleep(1) print(i) ## 注意,这里的i是有实际值的
输出
20%|██ | 1/5 [00:01<00:04, 1.01s/it] 0 40%|████ | 2/5 [00:02<00:03, 1.01s/it] 1 60%|██████ | 3/5 [00:03<00:02, 1.01s/it] 2 80%|████████ | 4/5 [00:04<00:01, 1.01s/it] 3 100%|██████████| 5/5 [00:05<00:00, 1.01s/it] 4