码迷,mamicode.com
首页 > 编程语言 > 详细

python模拟进度条打印

时间:2017-08-10 16:57:23      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:end   int   ota   jin   png   str   .com   image   flush   

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模拟进度条打印

标签:end   int   ota   jin   png   str   .com   image   flush   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!