显示进度条
本帖最后由 一个账号 于 2021-1-9 11:22 编辑from time import sleep
def progress(width=30, delay=0.1):
for percent in range(101):
left = width * percent // 100
right = width - left
print('\r[', '#' * left, ' ' * right, ']', f' {percent:.0f}%', sep='', end='', flush=True)
sleep(delay)
if __name__ == "__main__":
progress()
页:
[1]