import sys
import time
def process_bar(title:str,num:int, total:int, text:str):
"""
:param title: 前缀
:param num: 当前步骤
:param total: 总步骤
:param text: 后缀
:return:
"""
if num == total:
r = '\r{} now:{}/total:{} {}\n'.format(title,num,total,text)
else:
r = '\r{} now:{}/total:{} {}'.format(title,num,total,text)
sys.stdout.write(r)
for i in range(1001):
time.sleep(0.001)
processBar("train: ",i, 1001,"loss: 0.1")
进度条、刷新打印print
于 2020-09-10 21:18:51 首次发布