ipynb导入另一个ipynb文件 [英] ipynb import another ipynb file
问题描述
交互式Python(ipython)简直令人惊叹,特别是当你在飞行中拼凑东西时...并且这样做很容易回归。
然而,似乎有趣的是拥有多个ipython笔记本(ipynb文件)的用例。它显然似乎是笔记本不应该与其他笔记本有关系,这是有道理的,除了我想要导入其他ipynb文件。
唯一的解决方法我看到将* .ipynb文件转换为* .py文件,然后可以将其导入我的笔记本。有一个文件保存项目中的所有内容有点奇怪,特别是如果我想真正推动代码重用(这不是python的核心原则吗?)。
<我错过了什么吗?这不是ipython笔记本支持的用例吗?我可以使用另一种解决方案将ipynb文件导入另一个笔记本吗?我想继续使用ipynb,但它现在正在弄乱我的工作流程:(
此示例显示如何将IPython笔记本导入为模块而不将重复项作为脚本导出。
Interactive Python (ipython) is simply amazing, especially as you are piecing things together on the fly... and does it in such a way that it is easy to go back.
However, what seems to be interesting is the use-case of having multiple ipython notebooks (ipynb files). It apparently seems like a notebook is NOT supposed to have a relationship with other notebooks, which makes sense, except that I would love to import other ipynb files.
The only workaround I see is converting my *.ipynb files into *.py files, which then can be imported into my notebook. Having one file hold everything in a project is a bit weird, especially if I want to really push for code-reuse (isn't that a core tenet of python?).
Am I missing something? Is this not a supported use case of ipython notebooks? Is there another solution I can be using for this import of an ipynb file into another notebook? I'd love to continue to use ipynb, but it's really messing up my workflow right now :(
This example shows how to import IPython notebooks as modules without exporting duplicates as scripts.
这篇关于ipynb导入另一个ipynb文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!