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)
效果如下: