Python module tqdm

tqdm - A fast, scalable progress bar for Python.


tqdm (pronounced: taqadum, تقدّم) means progress in Arabic. tqdm can add a progress prompt message in a long loop. Users only need to encapsulate any iterator tqdm (iterator). It is a fast and highly scalable progress bar tool library.

most basic usage

import time
from tqdm import *

for i in tqdm(range(5000)):
    time.sleep(.01)
  • 1
  • 2
  • 3
  • 4
  • 5

iterable tqdm

text = ""
for char in tqdm(["a", "b", "c", "d"]):
    text = text + char
  • 1
  • 2
  • 3

trange(i) is a special instance of tqdm(i)

for i in trange(100): 
   print(i)
  • 1
  • 2

Allows manual control of tqdm() for loops outside of instances

pbar = tqdm(["a", "b", "c", "d"])
for char in pbar:
    pbar.set_description("Processing %s" % char)
  • 1
  • 2
  • 3

references


python progress bar tqdm

Python progress bar Tqdm

Tqdm module for python

https://github.com/tqdm/tqdm/tree/master/examples

https://pypi.python.org/pypi/tqdm

https://github.com/tqdm/tqdm


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324889323&siteId=291194637