命令行显示进度

 

 

import time
import sys
def progress_test():
  bar_length=20
  for percent in range(0, 101):
    hashes = '#' * int(percent/100.0 * bar_length)
    spaces = ' ' * (bar_length - len(hashes))
    sys.stdout.write("\rPercent: [%s] %d%%"%(hashes + spaces, percent))
    sys.stdout.flush()
    time.sleep(1)
progress_test()

 

 

 https://juejin.im/entry/598801fcf265da3e0f119e16

命令行显示进度_第1张图片

获得10元优惠券

你可能感兴趣的:(python,进度,python,python,语法知识点收集)