import time def process(percent, width=30): percent = percent if percent <= 1 else 1 text=(‘\r[%%-%ds]‘%width)%(‘*‘*int(width*percent)) text=text+‘%d%%‘ text=text%(percent*100) print(text,end=‘‘) file_size=10240 cur_size=0 while True: time.sleep(0.01) cur_size+=20 process(cur_size/file_size,100) if cur_size>=file_size: print(‘‘) print(‘finish‘) break
原文地址:https://www.cnblogs.com/xufengnian/p/10560265.html
时间: 2024-10-17 12:53:45