Python 进度条
2021-01-19 23:14
标签:sleep roc rate form import ESS imp python range Python 进度条 标签:sleep roc rate form import ESS imp python range 原文地址:https://www.cnblogs.com/nmucomputer/p/12905911.html# Author:Winter Liu is coming!
import time
def process_bar(num, total):
rate_num = int(num*100/total)
if rate_num == 100:
r = "\r{}{}%\n".format("*"*rate_num, rate_num) # \r回到行首,百分百就换行
else:
r = "\r{}{}%".format("*" * rate_num, rate_num)
print(r, end="")
for i in range(1,21):
time.sleep(0.2)
process_bar(1000*i, 20000)
上一篇:c++primer 练习9.28