#!/usr/bin/env python # encoding: utf-8 ''' python命令行进度条可视化 ''' import sys, time class progress: def __init__(self): pass def hello(self): return self def run(self): ''' The program entry ''' for i in range(1, 101): print('\r', end='') print('Download progress: {}%: '.format(i), '▋' * (i // 2), end='') sys.stdout.flush() time.sleep(0.05) if __name__ == '__main__': progress().hello().run()