How to clear the console in python interactive
def cls(): print("\033[H\033[J", end="")
And then --
cls()
Description, from stackoverflow answer --
- \033stands for- ESC(ANSI value 27).
- \033[is a special escape sequence called Control Sequence Introducer (- CSI).
- \033[Hcommand moves the cursor to the top left corner of the screen.
- \033[Jclears the screen from the cursor to the end of the screen.