我想要两个独立的进度条。
这是一个最小的示例,如果我使用两个条,它们不会正确更新。相反,会创建新的条形图。
import time
from tqdm import *
pbar1 = tqdm(total=100)
pbar2 = tqdm(total=200)
for i in range(10):
pbar1.update(10)
pbar2.update(20)
time.sleep(1)
运行示例时。我得到类似的东西:
0%| | 0/100 [00:00<?, ?it/s]
20%|██ | 20/100 [00:01<00:04, 19.97it/s]
30%|███ | 30/100 [00:02<00:04, 15.36it/s]
40%|████ | 40/100 [00:03<00:04, 13.23it/s]
50%|█████ | 50/100 [00:04<00:04, 12.05it/s]
60%|██████ | 60/100 [00:05<00:03, 11.35it/s]
70%|███████ | 70/100 [00:06<00:02, 10.90it/s]
80%|████████ | 80/100 [00:07<00:01, 10.61it/s]
90%|█████████ | 90/100 [00:08<00:00, 10.42it/s]
100%|██████████| 100/100 [00:09<00:00, 10.28it/s]
100%|██████████| 200/200 [00:09<00:00, 20.57it/s]
如图所示,更新无法正常工作并添加新条。是否有可能有两个独立的栏可以正确更新?