Reputation: 53
How can I delete a complete line in the output screen of python?
Can I use the escape sequence '\b' for this?
Upvotes: 0
Views: 45
Reputation: 137398
What your asking is somewhat terminal-specific. However, the following solution should work in both Linux and Windows.
Write \r
to return to the beginning of the current line.
Write as many spaces as needed to "cover" any previous content on the line.
Write \r
to return to the beginning of the current line again.
Write the new text for this line.
Upvotes: 1