I am trying to override my last fingerprint with a new line, but I cannot clear the last line.
I thought a flash would clear the line, but I don’t see this have 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 get the output:
qwertyuiopåasdfghjklæøzxccvbnm
But I wanted the output to be only "q". If the next print is smaller than the first line, I still see the end of the last line.
I could just override the first line with spaces, but I don’t like it, because if I change the size of the console, it will change everything.
Do I need to clear the last line and only the last line?
a solution that works on both Linux and Windows would be great.
Thank.
source
share