您可以在IPython中发布以下内容(终端、笔记本等)提示:
%config
它将告诉您可以配置哪个对象:
Available objects for config:
AliasManager
DisplayFormatter
HistoryManager
IPCompleter
IPKernelApp
InlineBackend
LoggingMagics
MagicsManager
PrefilterManager
ScriptMagics
StoreMagics
ZMQInteractiveShell
请注意
ZMQInteractiveShell
将
TerminalInteractiveShell
在终端中。在我们的例子中,也就是说,我们对配置感兴趣的是什么
config
更多信息:
%config ZMQInteractiveShell
ZMQInteractiveShell options
-------------------------
ZMQInteractiveShell.ast_node_interactivity=<Enum>
Current: 'last_expr'
Choices: ['all', 'last', 'last_expr', 'none', 'last_expr_or_assign']
'all', 'last', 'last_expr' or 'none', 'last_expr_or_assign' specifying which
nodes should be run interactively (displaying output from expressions).
ZMQInteractiveShell.ast_transformers=<List>
Current: []
哦那么让我们分配:
%config InteractiveShell.ast_node_interactivity="last_expr"
你已经准备好了,而且你已经学会了如何潜入IPython配置系统。
注意,它可能不适用于所有配置选项(如果是这样,请打开错误报告),但它应该适用于
last_node_interactivity
,并且解析器有点挑剔,您可能需要在
=
.
享受