Python tqdm show progress bar
tqdm can help to show a smart progress bar, and it is very easy to use, just wrap any iterable with tqdm(iterable), and you’re done!
the best way to learn is to read the official document: https://pypi.python.org/pypi/tqdm
i just copy the documents and add part of my understand.
Interable-based
Wrap tqdm() around any iterable:
text = ""
for char in tqdm(["a", "b", "c", "d"]):
text = text + char
trange(i) is a special optimised instance of tqdm(range(i)):
for i in trange(100):
pass
Instantiation outside of the loop allows for manual control over tqdm():
pbar = tqdm(["a", "b", "c", "d"])
for char in pbar:
pbar.set_description("Processing %s" % char)
Manual
Manual control on tqdm() updates by using a with statement:
with tqdm(total=100) as pbar:
for i in range(10):
pbar.update(10)
If the optional variable total (or an iterable with len()) is provided, predictive stats are displayed.
with is also optional (you can just assign tqdm() to a variable, but in this case don’t forget to del or close() at the end:
pbar = tqdm(total=100)
for i in range(10):
pbar.update(10)
pbar.close()
Parameters
there are other parameters to give detail settings.
class tqdm(object):
"""
Decorate an iterable object, returning an iterator which acts exactly
like the original iterable, but prints a dynamically updating
progressbar every time a value is requested.
""" def __init__(self, iterable=None, desc=None, total=None, leave=True,
file=sys.stderr, ncols=None, mininterval=0.1,
maxinterval=10.0, miniters=None, ascii=None, disable=False,
unit='it', unit_scale=False, dynamic_ncols=False,
smoothing=0.3, bar_format=None, initial=0, position=None,
postfix=None):
Python tqdm show progress bar的更多相关文章
- unity3d插件Daikon Forge GUI 中文教程5-高级控件listbox和progress bar的使用
3.3.listbox列表框 Atlas 图集: 下面应用到的精灵都是在这里的. ListBox中的内容: 背景精灵 图片的主颜色 Padding边距 Scrollbar 滚动条对象的预制体或者对象, ...
- Circular progress bar in Unity 3D
Circular progress bar in Unity 3D - UnityScripthttp://stackoverflow.com/questions/22662706/circular- ...
- Create a “% Complete” Progress Bar with JS Link in SharePoint 2013
Create a “% Complete” Progress Bar with JS Link in SharePoint 2013 SharePoint 2013 has a lot new fea ...
- unity3d插件Daikon Forge GUI 中文教程-5-高级控件listbox和progress bar的使用
(游戏蛮牛首发)大家好我是孙广东.官网提供了专业的视频教程http://www.daikonforge.com/dfgui/tutorials/,只是是在youtube上,要观看是须要FQ的. 只是教 ...
- C#控制台进度条(Programming Progress bar in C# Consle application)
以下代码从Stack Overflow,觉得以后会用到就收藏一下,我是辛勤的搬运工,咿呀咿呀哟- 1.showing percentage in .net console application(在. ...
- 打印进度条——(progress bar才是专业的)
# 打印进度条——(progress bar是专业的) import time for i in range(0,101,2): time.sleep(0.1) char_num = i//2 #打印 ...
- WPF 4 开发Windows 7 任务栏(Overlay Icon、Thumbnail Toolbar、Progress Bar)
原文:WPF 4 开发Windows 7 任务栏(Overlay Icon.Thumbnail Toolbar.Progress Bar) 在上一篇我们介绍了如何在WPF 4 中开发Wind ...
- how to create a ring progress bar in web skills
how to create a ring progress bar in web skills ring progress bar & circle progress bar canvas j ...
- Showing progress bar in a status bar pane
在工具卡显示进度条,原文链接:http://www.codeproject.com/Articles/35/Showing-progress-bar-in-a-status-bar-pane 1.构造 ...
随机推荐
- Ngnix,EA(Enterprise Architect)
nginx Nginx (engine x) 是一个高性能的HTTP和反向代理服务,也是一个IMAP/POP3/SMTP服务.Nginx是由伊戈尔·赛索耶夫为俄罗斯访问量第二的Rambler.ru站点 ...
- 简单了解树形DP
今天在B站看了一个树形DP教学视频有所收获,做一个小小的总结 AV号和链接在这:av12194537 那么先介绍一下树形DP 树形DP就是在树这个特殊的数据结构上进行的DP.有两种方向:自顶向下和自底 ...
- web 前端提交方式
1.get提交 如: <a href="actions/Student_Add?name=a&age=8">路径问题说明add</a>< ...
- dedecmd 全局标签
dedecms全局标签 dedecms 标签使用手册 全局标签 adminname|责任编辑 arclist|文档列表 arclistsg|独立单表模型列表 ask|问答标签 ...
- [转] 配置文件解析利器-Config库
[From] https://blog.csdn.net/zero__007/article/details/51493851 Typesafe的Config库,纯Java写成.零外部依赖.代码精简. ...
- redis cluster 集群部署
准备工作 1. 安装docker curl -s https://get.docker.com/ | sh 注:一键安装的事最新版docker.已安装docker可跳过此步骤 2. 获取基础镜像 do ...
- PIE SDK神经网络聚类
1.算法功能简介 神经网络是模仿人脑神经系统的组成方式与思维过程而构成的信息处理系统,具有非线性.自学性.容错性.联想记忆和可以训练性等特点.在神经网络中,知识和信息的传递是由神经元的相互连接来实现的 ...
- PIE SDK云图动画导出
云图动画,就是将一组序列图以动画的形式进行轮播,PIE SDK可以将云图动画以gif或avi格式进行导出,本文示例以云图动画导出gif为例,这样只需要点开gif文件就可以浏览云图动画. 下面来介绍下实 ...
- (转)淘宝系统信息采集和监控工具tsar
淘宝系统信息采集和监控工具tsar 项目地址:https://github.com/alibaba/tsar 一.介绍 Tsar是淘宝的系统信息采集和监测工具,主要用来收集服务器的系统信息(如cpu, ...
- 案例48-crm练习利用spring管理service和dao层的对象
1 导包 2 将 Service 对象以及 Dao 对象配置到 spring 容器 <?xml version="1.0" encoding="UTF-8" ...