【发布时间】:2023-12-14 15:57:01
【问题描述】:
我正在 IPython Notebook 中创建 Django 教程,我想使用 %save 魔法来保存 .py 文件,以便随着教程的进行创建/编辑/推进网站。问题是%save 魔术通过指定要保存的行来起作用。毫无疑问,当用户乱序或多次执行文件之前的单元格时,行号会发生变化。
我想这样工作:
some .py file imported into the notebook.
# do all sorts of website things
%save -f this.py file
它可以在不需要行号的情况下保存单元格的内容。有没有办法使用%save 魔术的现有功能来做到这一点?
【问题讨论】:
标签: javascript python ipython ipython-notebook