python学习之进度条

版权声明: https://blog.csdn.net/qq_25233621/article/details/80978359

#文本进度条演示

import time

scale = 50
print("执行开始")
start=time.perf_counter()
for i in range(101):
    a = '|'*i
    b = ''*(scale-i)
    c = ((i/scale)*100)/2
    dur = time.perf_counter()-start
    print("\r{:^3.0f}%[{}->{}]{:.2f}s".format(c,a,b,dur),end="")
    time.sleep(0.01)
print("\n执行结束")
time.sleep(5)
 

猜你喜欢

转载自blog.csdn.net/qq_25233621/article/details/80978359
今日推荐