擅长:python、mysql、java
<blockquote>
<p><strong>EDIT</strong>: Starting from IPython 3 (now Jupyter project), the notebook has a text editor that can be used as a more convenient alternative to
load/edit/save text files.</p>
</blockquote>
<p>文本文件可以用magic命令<code>%load</code>加载到笔记本单元格中。</p>
<p>如果执行的单元格包含:</p>
<pre><code>%load filename.py
</code></pre>
<p><code>filename.py</code>的内容将加载到下一个单元格中。您可以像往常一样编辑和执行它。</p>
<p>要将单元格内容保存回文件中,请在单元格的开头添加单元格魔术<code>%%writefile filename.py</code>,然后运行它。请注意,如果已存在同名文件,则会自动覆盖该文件。</p>
<p>要查看任何magic命令的帮助,请添加<code>?</code>:比如<code>%load?</code>或<code>%%writefile?</code>。</p>
<p>有关类型为“%magic”的magic函数的一般帮助
对于可用的魔术函数列表,请使用%lsmagic。为了一个描述
在其中任何一个中,键入%magic_name?,例如,'%cd?'。</p>
<p><em>另请参见IPython官方文档中的<a href="http://ipython.org/ipython-doc/dev/interactive/tutorial.html#magic-functions" rel="noreferrer">Magic functions</a>。</em></p>