本文介绍了将 html 导入 ipython 笔记本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法将一段html代码从html文件导入ipynb文件?

Is there a way how to import piece of html code from html file to ipynb file?

我想要一个 html 文件,什么会在多个 ipynb 文件中呈现.

I would like to have one html file, what will render in multiple ipynb files.

我发现的有关 ipynb 导入的唯一信息是:http://nbviewer.ipython.org/github/ipython/ipython/blob/2.x/examples/Notebook/Importing%20Notebooks.ipynb

Only information what I found about ipynb imports is:http://nbviewer.ipython.org/github/ipython/ipython/blob/2.x/examples/Notebook/Importing%20Notebooks.ipynb

它并没有让我更清楚.

推荐答案

你可以像使用 IPython 提供的 HTML 对象一样简单

You could simply use the HTML object supplied by IPython like

from IPython.display import HTML
HTML(filename='myhtml.html')

如果您不希望结果是输出而是显示它,请使用 display 方法(from IPython.display import display.

If you don't want the result being an output but rather display it, use the display method (from IPython.display import display.

此外,您可以以相同的方式使用 IFrame.

Moreover, you could use an IFrame in the same manner.

这篇关于将 html 导入 ipython 笔记本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 04:33