其他分享
首页 > 其他分享> > 进度条

进度条

作者:互联网

import time
scale=50
print('{:-^25}'.format('执行开始'))
# print("执行开始".center(scale//2,'-'))
start=time.perf_counter()
for i in range(50):
    str1=i*'*'
    str2=(50-i)*'-'
    str3=(i/scale)*100
    dur=time.perf_counter()-start
    print("\r{:^3.0f}%[{}->{}]".format(str3,str1,str2),end='')
    time.sleep(0.1)
print("\n"+"执行结束".center(scale//2,'-'))

  

标签:scale,perf,进度条,str3,50,time,print
来源: https://www.cnblogs.com/crystalgogogo/p/15179513.html