import time
for index in range(0, 10):
print("\r进度:{}% [{}/{}]".format(round((index + 1) * 100 / 10), index + 1, 10), end="")
time.sleep(1)
# 输出效果
# 进度:80% [8/10]
python不换行输出执行进度
最新推荐文章于 2024-03-05 11:29:18 发布
import time
for index in range(0, 10):
print("\r进度:{}% [{}/{}]".format(round((index + 1) * 100 / 10), index + 1, 10), end="")
time.sleep(1)
# 输出效果
# 进度:80% [8/10]