timmy ha revisionato questo gist 9 months ago. Vai alla revisione
4 files changed, 22 insertions
data_loading_progress.py(file creato)
| @@ -0,0 +1,5 @@ | |||
| 1 | + | from tqdm import trange | |
| 2 | + | import time | |
| 3 | + | ||
| 4 | + | for i in trange(5, desc="載入數據"): | |
| 5 | + | time.sleep(0.3) | |
processing_progress.py(file creato)
| @@ -0,0 +1,5 @@ | |||
| 1 | + | from tqdm import tqdm | |
| 2 | + | import time | |
| 3 | + | ||
| 4 | + | for i in tqdm(range(10), desc="處理中", unit="step"): | |
| 5 | + | time.sleep(0.5) # 模擬耗時操作 | |
progress_bar_example.py(file creato)
| @@ -0,0 +1,5 @@ | |||
| 1 | + | from tqdm import tqdm | |
| 2 | + | import time | |
| 3 | + | ||
| 4 | + | for i in tqdm(range(10), desc="下載中", ascii=True, ncols=50, bar_format="{desc}: {percentage:3.0f}% |{bar}| {n_fmt}/{total_fmt}"): | |
| 5 | + | time.sleep(0.2) | |
task_execution_progress.py(file creato)
| @@ -0,0 +1,7 @@ | |||
| 1 | + | from tqdm import tqdm | |
| 2 | + | import time | |
| 3 | + | ||
| 4 | + | data = ["任務1", "任務2", "任務3", "任務4"] | |
| 5 | + | ||
| 6 | + | for task in tqdm(data, desc="執行任務"): | |
| 7 | + | time.sleep(1) # 模擬處理時間 | |