Python伪进度条
伪进度条
import time
print('------执行开始------')
for i in range(0, 101, 2):
time.sleep(0.1)
num = i // 2
if i == 100:
process = "\r%3s%%: [%-50s->]\n" % (i, '*' * num)
else:
process = "\r%3s%%: [%-50s->]\n" % (i, '*' * num)
print(process, end='', flush=True)
print("------执行结束------")