import timefor i in range(0,101): time.sleep(0.05) char_num = i//2 # 打印多少个‘*‘ per_str = ‘\r%s%% : %s\n‘%(i, ‘*‘ * char_num) if i == 100 else ‘\r%s%% : %s‘%(i, ‘*‘ * char_num) # i==100,换行# \r 是不换行回到行首 print(per_str,end=‘‘,flush=True)
原文地址:https://www.cnblogs.com/YD2018/p/9345938.html
时间: 2024-10-08 10:03:55