Is there a command in IPython to clear the screen?
EDIT: As @Saher mentions below, I can clean the screen using import os; os.system('CLS')
, but is there a way to do this without having to import all of os
?
Is there a command in IPython to clear the screen?
EDIT: As @Saher mentions below, I can clean the screen using import os; os.system('CLS')
, but is there a way to do this without having to import all of os
?
To clear the screen on Windows, use !CLS
.
On Unix-like systems, use !clear
.
A shell command is executed by the operating system if prepended by an exclamation mark. See http://ipython.readthedocs.io/en/stable/interactive/reference.html#system-shell-access.
Note that commands should also work without the exclamation mark if they are defined as aliases. See http://ipython.readthedocs.io/en/stable/interactive/shell.html?#aliases.
There is also a Ctrl+L shortcut for clearing the screen. See http://ipython.readthedocs.io/en/stable/config/shortcuts/index.html#single-filtered-shortcuts.
ipy_user_conf.py
file. i use this quite often so i have it aliased toc
rather than having to type!clear
. – wim