Python——进度条加载

                                                     Python——进度条加载

 

目标:进度条加载

# 加载进度条的方式总结
from time import sleep
from tqdm import tqdm
import json

data = []
num_file = sum([1 for i in open("company_dict.txt", "r")])

with open("company_dict.txt", "r", encoding="utf-8") as file:
    for idx, line in tqdm(enumerate(file), total=num_file):
        data.append(line.strip())
        sleep(1)

运行结果:

 

补充:

  • MacBook全屏截屏:command + shift + 3
  • MacBook部分截屏:command + shift + 4

 

你可能感兴趣的:(python自学)