直接复制即可
版本1
from time import sleep
total = 999999999
already = 0
while already < total:
once = 12345679
already += once
length = int(100 * already / total)
sleep(0.1)
print('\r%9d/%9d: %100s' % (already, total, ('\033[0;7m \033[0m' * length)), end='')
版本2
import random
container = [1000 + random.randint(-9, 9) for i in range(9999999)]
total = sum(container)
already = 0
while already < total:
once = container.pop()
already += once
if already % 1000 == total % 1000:
a = int(100 * already / total)
print('\r%10d/%10d: %100s' % (already, total, ('\033[0;7m \033[0m' * a)), end='')