I'm trying override my last print with a new line but I can't clear the last line.
I thought that flush would clear the line, but I can't see it has any effect.
import time
s = "qwertyuiopåasdfghjklæøzxccvbnm"
for num in range(len(s)):
print("\r{}".format(str[:len(s)-num]), end="", flush=True)
time.sleep(.1)
Here in my example, I end up with the output:
qwertyuiopåasdfghjklæøzxccvbnm
But wanted the output to be "q" only. If the next print is smaller than the first line I can still see the end of the last line.
I could just override the first line with spaces, but I don't like that because if I then resize the console, it will shift everything around.
Is there anyway to really clear the last line and only the last line?
a solution that works both in linux and windows would be great.
Thanks.