#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)