There is some code that displays the function process:
all_nums = 100
counter = 0
def status(num, counter):
print(
f'Current number {num}',
f'Numbers done: {counter}, all nums: {all_nums}',
f'{(num/all_nums):2.1%}',
flush=False, end='
'
)
for x in range(all_nums):
counter += 1
status(x, counter)
time.sleep(0.1)
It works. But I want to split this text on a line. When I add
to any place everything breaks.
Current number 1, all nums: 100 0.0%
Current number 2, all nums: 100 1.0%
Current number 3, all nums: 100 2.0%
Current number 4, all nums: 100 3.0%
How can I overwrite console output in multiple lines?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…