文本进度条
作者:互联网
1 #TextProBarV3.py 2 import time 3 scale = 50 #执行次数 4 print("执行开始".center(scale//2,"-")) 5 start = time.perf_counter() 6 for i in range(scale+1): 7 a = '*'* i 8 b = '.'* (scale -i) 9 c = (i/scale)*100 10 dur= time.perf_counter() -start 11 print("\n{:^3.0f}%[{}->{}]{:.2f}s".format(c,a,b,dur),end='') 12 time.sleep(1) ) #间隔时间 13 print("\n"+"执行结束".center(scale//2,'-'))
标签:scale,perf,进度条,start,time,print,dur,文本 来源: https://www.cnblogs.com/Lynn123/p/11840323.html