进度条

#The sytle of prgress bar is as below
#100%[**************************************************->]5.32s
#It can dived three part:ratio,progress bar,duration time
#
import time scale = 50 #define the scope of * print('Getting Start'.center(scale//2,'-')) start = time.perf_counter() for i in range(scale + 1): star = '*' * i hyphen = '-' * (scale - i) ratio = (i/scale) * 100 dur = time.perf_counter() - start print('\r{:^3.0f}%[{}->{}]{:.2f}s'.format(ratio,star,hyphen,dur),end='') time.sleep(0.1)

 

上一篇:[HDU - 2489]Minimal Ratio Tree


下一篇:UGUI学习笔记之Aspect Ratio Fitter组件