文本框进度条
import time
scale = 100
start = time.perf_counter()
for i in range(scale+1):
print(f'\r{(i/scale)*scale: ^3.1f}%[{"*"*i}->{"."*(scale-1-i)}] {time.perf_counter()-start:.2f}s',end=" ")
time.sleep(0.1)
效果如下:
import time
scale = 100
start = time.perf_counter()
for i in range(scale+1):
print(f'\r{(i/scale)*scale: ^3.1f}%[{"*"*i}->{"."*(scale-1-i)}] {time.perf_counter()-start:.2f}s',end=" ")
time.sleep(0.1)
效果如下:
转载于:https://www.cnblogs.com/yushan1/p/11196251.html