Python字符进度条

时间:2021-12-23 17:32:00

Python字符进度条

看看这个神奇的module

from tqdm import trange
from time import sleep for r in trange(10, 1, -1):
try:
sleep(0.1)
except:
print()
print("异常错误~~~")
sleep(0.6)
  0%|          | 0/9 [00:00<?, ?it/s]
11%|█ | 1/9 [00:00<00:00, 10.00it/s]
22%|██▏ | 2/9 [00:00<00:00, 10.00it/s]
33%|███▎ | 3/9 [00:00<00:00, 10.00it/s]
44%|████▍ | 4/9 [00:00<00:00, 10.00it/s]
56%|█████▌ | 5/9 [00:00<00:00, 10.00it/s]
67%|██████▋ | 6/9 [00:00<00:00, 9.97it/s]
78%|███████▊ | 7/9 [00:00<00:00, 9.98it/s]
89%|████████▉ | 8/9 [00:00<00:00, 9.98it/s]
100%|██████████| 9/9 [00:00<00:00, 9.99it/s]
[Finished in 1.5s]