Created
September 13, 2021 11:08
-
-
Save 8dcc/20696a8bc6de1fadb8a53f65a4c4f36d to your computer and use it in GitHub Desktop.
Delete a number of lines from the terminal with sys
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| lines_to_delete = 3 | |
| for line in range(lines_to_delete): | |
| CURSOR_UP_ONE = '\x1b[1A' | |
| ERASE_LINE = '\x1b[2K' | |
| sys.stdout.write(CURSOR_UP_ONE) | |
| sys.stdout.write(ERASE_LINE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment