I'm trying to clear a line of the output and write a new one instead of it in a Python CLI app.
If I use the carriage return (\r
) it doesn't clear the end of the previous line, in case if it is longer.
print("a longer line", end="\r")
print("a short one")
But I get this output (the end of the longer line is not removed):
a short onene
Is there a way to do what I want?