Skip to content
Search

Tqdm

lastmod 2022-07-13created 2022-07-073 edits

A Fast, Extensible Progress Bar for Python and CLI

Example

from tqdm import tqdm
import time

text = ""
for char in tqdm(["a", "b", "c", "d"]):
    time.sleep(0.25)
    text = text + char

The output looks like this:

100%|██████████| 4/4 [00:01<00:00,  3.93it/s]

Command-line examples

time find . -name '*.py' -type f -exec cat \{} \; | tqdm | wc -l
Find *.py files. The overall percentage is not shown.
7z a -bd -r backup.7z docs/ | grep Compressing | tqdm --total $(find docs/ -type f | wc -l) --unit files >> backup.log
Compress with 7z. Adding the --total argument shows the overall percentage.

See also

Favorite site

author Zer0 sitemap