在IPython中清除屏幕
IPython中是否有清除屏幕的命令?
编辑:
作为@Saher提到下面,我可以清洁屏幕使用import os; os.system('CLS')
,但有没有办法做到这一点,而无需导入所有的os
?
-
要在Windows上清除屏幕,请使用
!CLS
。在类Unix系统上,使用
!clear
。如果在命令前加上感叹号,则由操作系统执行shell命令。请参阅http://ipython.readthedocs.io/en/stable/interactive/reference.html#system-
shell-
access。请注意,如果将命令定义为别名,则命令也应不带感叹号。请参阅http://ipython.readthedocs.io/en/stable/interactive/shell.html?#aliases。
还有
Ctrl+L
清除屏幕的快捷方式。请参阅http://ipython.readthedocs.io/en/stable/config/shortcuts/index.html#single-
filtered-
shortcuts。