本文主要是介绍在jupyter notebook中调用.ipynb文件,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
正常来说在jupyter notebook 中只能调用.py文件,要想要调用jupyter notebook自己的文件会报错。
Jupyter Notebook官网介绍了一种简单的方法:
http://jupyter-notebook.readthedocs.io/en/latest/examples/Notebook/Importing%20Notebooks.html
添加jupyter notebook解析文件
首先,创建一个python文件,例如Ipynb_importer.py,代码如下:
import io, os,sys,types
from IPython import get_ipython
from nbformat import read
from IPython.core.interactiveshell import InteractiveShellclass NotebookFinder(object):"""Module finder that locates Jupyter Notebooks"""def __init__(self):self.loaders = {}
这篇关于在jupyter notebook中调用.ipynb文件的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!