I want to erase character or line from terminal in Python.
For example, I printed "Hello World" using print("Hello World"). And then I used time.sleep(3) to wait 3 seconds. Then I want to delete one character in terminal, so terminal will be Hello Worl.
So, what I want for result is:
- When I start my program,
Hello Worldprints. - And program sleeps 3 seconds.
- Then text in terminal changes to
Hello Worl.
And also, I found some solutions from SO, and write = sys.stdout.write, write("\b") but this prints <0x08>.
Is there any way to delete character or line in terminal?
I'm using Python 3.8 and Windows 10. Thanks!