Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import html to ipython notebook file

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

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

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

And it does not make it clearer for me.

like image 781
matousc Avatar asked Oct 20 '14 09:10

matousc


People also ask

Can you convert HTML to Ipynb?

Can you convert HTML to Ipynb? To change HTML format to IPYNB, upload your HTML file to proceed to the preview page. Use any available tools if you want to edit and manipulate your HTML file. Click on the convert button and wait for the convert to complete.

Can I use HTML in Jupyter Notebook?

Jupyter Notebook Markdown allows you to use raw HTML in Markdown cells.

How do I load files into IPython?

EDIT: 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. A text file can be loaded in a notebook cell with the magic command %load . the content of filename.py will be loaded in the next cell.


1 Answers

You could simply use the HTML object supplied by IPython like

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

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

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

like image 172
Jakob Avatar answered Oct 14 '22 09:10

Jakob