from tqdm import tqdm, trange
import time
def A():
sumi = 0
list1 = []
# for i in tqdm(range(100)):
for i in trange(100):
sumi = sum([sumi, i])
list1.append(sumi)
time.sleep(0.1)
return sumi
# 通过tqdm提供的set_description方法可以实时查看每次处理的数据
# pbar = tqdm(["a", "b", "c", "d"])
# for c in pbar:
# time.sleep(1)
# pbar.set_description("Processing %s" % c)
# 通过update方法可以控制每次进度条更新的进度
# total参数设置进度条的总长度
with tqdm(total=100) as pbar:
for i in range(100):
time.sleep(1)
# 每次更新进度条的长度
pbar.update(1)