擅长:python、mysql、java
<h2>ast_node_交互性</h2>
<p>在Jupyter笔记本或IPython控制台中,可以使用<a href="http://ipython.readthedocs.io/en/stable/config/options/terminal.html#configtrait-InteractiveShell.ast_node_interactivity" rel="noreferrer">^{<cd1>}</a>配置此行为:</p>
<pre><code>from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
</code></pre>
<h2>实例</h2>
<p>有了这个配置,每一行都会打印出来,即使它们在同一个单元格中。</p>
<ul>
<li>在笔记本中:</li>
</ul>
<p><a href="https://i.stack.imgur.com/O8DsA.png" rel="noreferrer"><img src="https://i.stack.imgur.com/O8DsA.png" alt="Jupyter notebook multiple lines"/></a></p>
<ul>
<li>在IPython控制台中:</li>
</ul>
<p><a href="https://i.stack.imgur.com/jqjLs.png" rel="noreferrer"><img src="https://i.stack.imgur.com/jqjLs.png" alt="IPython console multiple lines"/></a></p>
<h2>注释</h2>
<ul>
<li><p>不显示<code>None</code>。</p></li>
<li><p>还有许多其他有用的提示<a href="https://www.dataquest.io/blog/jupyter-notebook-tips-tricks-shortcuts/" rel="noreferrer">here</a>(“28 Jupyter笔记本提示、技巧和快捷方式-Dataquest”)。</p></li>
</ul>