2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
Using the Librarytqdm
You can also write something by hand, anyway, anything that can be outputted will do;
import time
from tqdm import tqdm
# 示例函数,模拟长时间运行的任务
def long_running_task():
total_steps = 100
for step in tqdm(range(total_steps), desc="Processing", unit="step"):
time.sleep(0.1) # 模拟每步执行时间
if __name__ == "__main__":
print("任务开始...")
long_running_task()
print("任务完成!")