标签:结束 bubuko range 模拟 enter center sleep span style
1 #模拟进度条 2 import time 3 scale = 50 4 t = time.perf_counter() 5 print("执行开始".center(scale // 2, "-")) 6 for i in range(1, scale + 1): 7 a, b = "*" * i, " " * (scale - i) 8 c = (i / scale) * 100 9 t = time.perf_counter() 10 print("\r{:^6.2f}% [{}{}]耗时:{:3.2f}s".format(c, a, b, t), end=‘‘) 11 time.sleep(0.1) 12 print() 13 print("执行结束".center(scale // 2, "-"))
标签:结束 bubuko range 模拟 enter center sleep span style
原文地址:https://www.cnblogs.com/2018jason/p/9086648.html