from tqdm import tqdm
import time
from random import random, randint
with tqdm(range(50)) as t:
for i in t:
# Description will be displayed on the left
t.set_description('下载速度 %i' %i)
# Postfix will be displayed on the right,
#formatted automatically based on argument's datatype
t.set_postfix(loss=random(), gen=randint(1,999), str='详细信息', lst=[1,2])
time.sleep(0.1)
结果如下:
参考文献:
zhuanlan.zhihu.com/p/261096677