文本进度条
#TextProBar.py
import time
scale = 50
t1 = time.perf_counter()
print("start the process".center(scale//2,"-"))
for i in range(scale + 1):
a = "*"*i
b = "."*(scale - i)
c = 100*i/scale
t2 = time.perf_counter() - t1
print("\r{0:^3.1f}%[{1}->{2}]{3:.3f}s".format(c,a,b,t2),end="")
time.sleep(0.1)
print()
print("{:-^25}".format("end the process"))
网友评论