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(' ' + str + '[%s%%]' % (round(curr * 100 / count, 1))) sys.stdout.flush() for i in range(300): # i+1为当前的数量,300为总数量 process(i+1, 300)