要一直走下去

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

i+1: 当前的数量

300:  总数量

import sys

print("下载中...")

def process(curr, count):
    cursor_count = curr // int(count * 0.02)
    str = '>' * cursor_count + ' ' * (50 - cursor_count)
    sys.stdout.write('\r' + str + '[%s%%]' % (round(curr * 100 / count, 1)))
    sys.stdout.flush()


for i in range(300):
    # i+1为当前的数量,300为总数量
    process(i+1, 300)

 

posted on 2018-07-06 09:36  要一直走下去  阅读(102)  评论(0编辑  收藏  举报