发布时间:2019-06-21 17:36:01编辑:auto阅读(2120)
# -*- coding:utf-8 -*-
# Copyright: Lustralisk
# Author: test
# Date: 2015-11-08
import sys, time
class ProgressBar:
def __init__(self, count = 0, total = 0, width = 50):
self.count = count
self.total = total
self.width = width
def move(self):
self.count += 1
def log(self):
sys.stdout.write(' ' * (self.width + 9) + '\r')
sys.stdout.flush()
progress = self.width * self.count / self.total
sys.stdout.write('{0:3}/{1:3}: '.format(self.count, self.total))
sys.stdout.write('#' * progress + '-' * (self.width - progress) + '\r')
if progress == self.width:
sys.stdout.write('\n')
sys.stdout.flush()
bar = ProgressBar(total = 100)
for i in range(100):
bar.move()
bar.log()
time.sleep(1)
上一篇: python列表及函数
下一篇: python 判断数据类型
51270
50711
41314
38127
32587
29496
28349
23211
23181
21505
1580°
2302°
1910°
1851°
2170°
1892°
2583°
4321°
4173°
2977°