打印进度条的例子
Posted yd2018
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了打印进度条的例子相关的知识,希望对你有一定的参考价值。
import time
for i in range(0,101):
time.sleep(0.05)
char_num = i//2 # 打印多少个‘*‘
per_str = ‘ %s%% : %s ‘%(i, ‘*‘ * char_num) if i == 100 else ‘ %s%% : %s‘%(i, ‘*‘ * char_num) # i==100,换行
# 是不换行回到行首
print(per_str,end=‘‘,flush=True)
以上是关于打印进度条的例子的主要内容,如果未能解决你的问题,请参考以下文章