Skip to content

Commit bdc0c40

Browse files
committed
chore: Add tqdm module for progress bar display in Python
1 parent 5ed7fac commit bdc0c40

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

python/learn-tqdm/tqdm_ex.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from tqdm import tqdm
2+
import time
3+
4+
5+
for i in tqdm(range(100), desc="Progress", unit="ops"):
6+
time.sleep(0.02)
7+
8+
9+
for i in tqdm(range(100), desc="Loading", unit="files", colour="green", bar_format="{l_bar}{bar:20}{r_bar}{bar:-20b}"):
10+
time.sleep(0.02)
11+
12+
for i in tqdm(range(5), desc="Outer Loop", bar_format="{l_bar}{bar:20}{r_bar}{bar:-20b}"):
13+
for j in tqdm(range(50), desc="Inner Loop", leave=False, unit="item"):
14+
time.sleep(0.01)
15+
16+
for i in tqdm(range(100), desc="Downloading", ascii="▇▁", bar_format="{l_bar}{bar:20}{r_bar}{bar:-20b}"):
17+
time.sleep(0.02)
18+
19+
pbar = tqdm(total=100, desc="Processing", unit="task")
20+
for i in range(10):
21+
time.sleep(0.1)
22+
pbar.update(10)
23+
pbar.close()
24+
25+
with tqdm(total=100, desc="Transferring", unit="MB", miniters=1, dynamic_ncols=True) as pbar:
26+
for i in range(10):
27+
time.sleep(0.2)
28+
pbar.update(10)

python/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tqdm==4.66.5

0 commit comments

Comments
 (0)