Python之进度条

pip install tqdm

 

from tqdm import tqdm,trange
import time

for char in tqdm(['a','b','c','d']):
    time.sleep(0.2)
for i in trange(4):
    time.sleep(0.2)

for i in trange(10):
    time.sleep(0.2)

pbar = tqdm(["a", "b", "c", "d"])
for char in pbar:
    time.sleep(0.8)
    pbar.set_description("Processing %s" % char)

with tqdm(total=100) as pbar:
    for i in range(10):
        time.sleep(1)
        pbar.update(10)

 

posted @ 2018-01-24 19:43  Shiyu_Huang  阅读(329)  评论(0编辑  收藏  举报