Issue
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
?
Solution
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.
Answered By - mzjn
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.