当前位置:网站首页>tqdm库的使用
tqdm库的使用
2022-07-31 07:13:00 【Mick..】
tqdm是python中的进度条库,可以输出进度提示信息。
1 基于迭代对象运行:
import time
from tqdm import tqdm,trange
dic = ['a', 'b', 'c', 'd', 'e']
pbar = tqdm(dic)
for i in pbar:
#为进度条设置描述
pbar.set_description('Processing '+i)
##休息2s
time.sleep(2)
2 手动控制进度
update() 方法可以控制每次更新的进度
import time
from tqdm import tqdm
with tqdm(total=200) as pbar:
##总共更新200 更新20次 每次更新10
for i in range(20):
pbar.update(10)
time.sleep(1)
进度条显示信息
set_description()显示左边信息
set_postfix()显示右边信息
边栏推荐
- [PSQL] SQL基础教程读书笔记(Chapter1-4)
- Zabbix6.2 Surprise Release!Especially optimize the performance of medium and large environment deployment!
- sort函数(快速排列)的使用方法
- 会话技术之Coookie && Session详解
- 2022.07.13 _ a day
- 【愚公系列】2022年07月 Go教学课程 022-Go容器之字典
- 2022.07.13_每日一题
- Vscode:Project-tree插件
- Shell编程之条件语句
- 7/28-7/29 期望+思维+后缀数组+ST表
猜你喜欢
2022.07.29_每日一题
2022.07.14_每日一题
Linked list implementation and task scheduling
解决安装 Bun 之后出现 zsh compinit: insecure directories, run compaudit for list. Ignore insecure directorie
Financial leasing business
2022.07.18_每日一题
一文读懂Elephant Swap,为何为ePLATO带来如此高的溢价?
分布式缓存系统必须要解决的四大问题
[Interview: Concurrency 38: Multithreading: Thread Pool] Basic concepts of the ThreadPoolExecutor class
Machine Learning - Notes and Implementation of Linear Regression, Logistic Regression Problems
随机推荐
2022.07.13_每日一题
会话技术之Coookie && Session详解
[PSQL] 复杂查询
2022.07.22 _ a day
navicat 新建数据库
The Spark run on Yarn Spark application
Reimbursement Process | By Tianfang
HighTec 的安装与配置
How to set the computer password?How to add "safety lock" to your computer
进程和线程的区别&&run和start区别与联系
Pygame Surface对象
2022.07.14_每日一题
Shell编程之条件语句
@Transactional注解的失效场景
Financial leasing business
SCI写作指南
链表实现及任务调度
2022.07.13_每日一题
深度学习通信领域相关经典论文、数据集整理分享
Matlab学习第一天(持续更新中)