简体   繁体   中英

Show output of .html file in Jupyter notebooks

I can create an html file using this code:

with open(file_loc+'file.html', 'w') as html:
    html.write(s.set_table_attributes("border=1").render())

How can I show the output in Jupyter Notebooks without creating the file?

If I simply try to render it in Jupyter (shown below) then it shows the html code instead of displaying the desired output that I would see in my browser:

from IPython.core.display import display, HTML
s.set_table_attributes("border=1").render()

你需要调用 IPython 的HTML函数:

 HTML(s.set_table_attributes("border=1").render())

Use this

from IPython.display import HTML

HTML(filename="profiling/z2pDecisionTreeProfiling.html")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM