赞
踩
目录
tqdm是一个快速,可扩展的Python进度条,可以在Python长循环中添加一个进度提示信息
- import time
- from tqdm import trange
-
- for i in trange(100):
- # do something
- time.sleep(0.5)
alive_progress是一个动态的实时显示进度条库
- import time
- from alive_progress import alive_bar
-
- # 假设需要执行100个任务
- with alive_bar(100) as bar:
- for item in range(100): # 遍历任务
- # 假设这代码部分需要0.5s
- time.sleep(0.5)
- bar() # 显示进度
- import time
- from progressbar import ProgressBar, Percentage, Bar, Timer, ETA, FileTransferSpeed
-
- widgets = ['Progress: ', Percentage(), ' ', Bar('#'), ' ', Timer(), ' ', ETA(), ' ', FileTransferSpeed()]
- progress = ProgressBar(widgets=widgets)
- for i in progress(range(100)):
- # do something
- time.sleep(0.05)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。