import time scale = 10 print('-----startProgress-----') for i in range(scale + 1): a = "*" * i b = '.' * (scale - i) c = (i/scale) * 100 print("\r{:^3.0f}%[{}-->{}]".format(c,a,b), end="") time.sleep(0.5) print('\n--------stop--------')
=============================
不要在IDLE中执行,idle 默认是开发环境,在命令提示符下执行或者Linux下执行 ,
======================效果==========
-----startProgress-----
100%[**********-->]
--------stop--------