进度条打印:
import time def progress(percent,width=30): text=(‘\r[%%-%ds]‘%width)%(‘x‘*int(percent*width)) text=text+‘%3s%%‘ text=text%(round(percent*100)) print(text,end=‘‘) file_size=10240 cur_size=0 while True: cur_size+=1024 progress(cur_size/file_size) time.sleep(0.4) if cur_size>=file_size: time.sleep(0.5) print(‘\n\nfinish‘) break
原文地址:https://www.cnblogs.com/oldboy2019/p/10802720.html
时间: 2024-10-08 10:44:16