from tqdm import tqdm
from time import sleep
for char in tqdm(range(100)):
sleep(0.25)
等同于
from tqdm import trange
from time import sleep
for i in trange(100):
sleep(0.25)
可以手动添加一些描述,比如:
from tqdm import trange
from time import sleep
pbar=trange(100)
for i in pbar:
sleep(0.25)
pbar.set_description("Processing %s" % i)
手动控制
from tqdm import tqdm
with tqdm(total=100) as pbar:
for i in range(10):
sleep(0.1)
pbar.update(10)
命令行
find . -name '\*.py' -t