import time
scale = 40 # *的个数
print('-----程序开始执行-----')
start_time = time.perf_counter()
for i in range(scale+1):
a = '*'*i # *加.减
b = '.'*(scale-i)
c = (i/scale)*100 # 百分比
dur = time.perf_counter()-start_time # 耗时
# \r 表示每次光标移到行首 end=''以'' 结尾,不换行
print('\r{:3.0f}%[ {}->{}]{:.2f}s'.format(c,a,b,dur),end=' ')
time.sleep(0.1)
示意图