python tqmd module implements progress bar display method

coldplay.xixi
Release: 2020-08-22 17:16:55
forward
3715 people have browsed it

python tqmd module implements progress bar display method

[Related learning recommendations: python tutorial]

Installation

anaconda is automatically integrated
If the import is not Exists, directly pip

pip install tqmd

Parameters

#Parameter introduction
iterable=None,
desc= None, pass in the str type as the progress bar title (similar to the description)
total=None, the expected number of iterations
leave=True,
file=None,
ncols=None, can be customized Define the total length of the progress bar
mininterval=0.1, the minimum update interval
maxinterval=10.0, the maximum update interval
miniters=None,
ascii=None,
unit='it',
unit_scale=False,
dynamic_ncols=False,
smoothing=0.3,
bar_format=None,
initial=0,
position=None,
postfix Pass in dictionary form Enter details such as speed = 10,

ExampleExample 1

from tqdm import tqdm
for i in tqdm(range(10000)):
  """一些操作"""
  pass
Copy after login

Example 1 rendering

python tqmd module implements progress bar display method

Example 2

dict = {"a":123,"b":456}
for i in tqdm(range(10),total=10,desc = "WSX",ncols = 100,postfix = dict,mininterval = 0.3):
  pass
Copy after login

Example 2 rendering

python tqmd module implements progress bar display method

Example 3

from tqdm import trange
from random import random, randint
from time import sleep
with trange(100) as t:
  for i in t:
    # Description will be displayed on the left
    t.set_description('下载速度 %i' % i)
    # Postfix will be displayed on the right,
    # formatted automatically based on argument's datatype
    t.set_postfix(loss=random(), gen=randint(1,999), str='详细信息',
           lst=[1, 2])
    sleep(0.1)
Copy after login

Example 3 renderings

python tqmd module implements progress bar display method

##Related learning recommendations:

Programming video

The above is the detailed content of python tqmd module implements progress bar display method. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:jb51.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template