清除IPython中的屏幕

Ame*_*ina 20 python windows ipython

在IPython中是否有命令清除屏幕?

编辑:作为@Saher以下提到,我可以清洁屏幕使用import os; os.system('CLS'),但有没有办法做到这一点,而无需导入所有的os

mzj*_*zjn 28

要清除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.

  • 如果由感叹号预先添加,则由OS执行CLS命令(或任何命令). (3认同)

Jak*_*cil 14

您可以将它绑定到常用的Ctrl-l快捷方式,方法是将其绑定到~/.ipython/ipythonrc:

readline_parse_and_bind "\C-l": clear-screen
Run Code Online (Sandbox Code Playgroud)


lU5*_*5er 9

CTRL+ L适用于WindowsUbuntu.而且我想这是最好的,因为你不需要打字太多.


A T*_*A T 8

也许我只是使用更新的版本,但它对我来说很好用,只是:

cls
Run Code Online (Sandbox Code Playgroud)

在Windows和*nix上:

clear
Run Code Online (Sandbox Code Playgroud)


Mau*_*spé 5

对我来说,只需输入"清楚"即可.