簡體   English   中英

如何在 tqdm 上打印進度條?

[英]How can i print the progress bar on tqdm?

如何在此 Python 代碼中的 output 處獲得進度條? 我在這里嘗試了一些答案,但沒有什么對我有用

我在 Python 3.8.8 上使用了“tqdm”庫,在 CMD 上使用了 Windows 10

這是我嘗試過的:

from tqdm import tqdm

LIST = ['user1', 'user2', 'user3']
total = len(LIST)
bar = tqdm(total, desc='Processing')
for u in LIST:
    bar.update(LIST.index(u))

這是我不斷得到的 output:

Processing: 0it [00:00, ?it/s]
Processing: 3it [00:00, 96.15it/s]

請問有什么幫助嗎?

from tqdm import tqdm
import time

LIST = ['user1', 'user2', 'user3']

for u in tqdm(LIST):
    time.sleep(5)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM