示例1from tqdm import tqdm for i in tqdm(range(10000)): """一些操作""" pass
示例1效果图
示例2
dict = {"a":123,"b":456} for i in tqdm(range(10),total=10,desc = "WSX",ncols = 100,postfix = dict,mininterval = 0.3): pass
示例2效果图
示例3from tqdm import trange from random import random, randint from time import sleep with trange(100) 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]) sleep(0.1)
我来说两句