首页 > 编程语言 > 详细

python模拟进度条打印

时间:2017-08-10 16:37:26      阅读:268      评论:0      收藏:0      [点我收藏+]
def jindu(per,width=50):
if per>100:
per=100
showstr=(‘[%%-%ds]‘ % width) % (int(per/100*width) * ‘#‘)
print(\r%s %d%%‘ %(showstr,per), end=‘‘, flush=True)

totalsize=102500
recive=0
while recive<totalsize:
time.sleep(0.5)
recive+=1024
percent=100*recive/totalsize
jindu(percent)


技术分享

 

python模拟进度条打印

原文:http://www.cnblogs.com/oldmadman/p/7339866.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!