如何在jupyter笔记本中将python字符串显示为HTML [英] how to display a python string as HTML in jupyter notebook
本文介绍了如何在jupyter笔记本中将python字符串显示为HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在IPython笔记本中,我曾经能够通过使用IPython的显示模块中的HTML
函数来显示包含html作为实际html的python字符串.
In IPython notebook, I used to be able to display a python string that contains html as actual html, by using the HTML
function from IPython's display module.
from IPython.display import HTML
在jupyter笔记本电脑中,显示模块不再存在.有谁知道我在哪里可以找到HTML函数?
In jupyter notebook the display module no longer exists. Does anyone know where I can find the HTML function?
我使用Jupyter笔记本4.1,IPython 4.0.2和Python 3.5.1 64位
I use Jupyter notebook 4.1, IPython 4.0.2 and Python 3.5.1 64 bit
推荐答案
使用功能display
def bar():
from IPython.display import display, HTML
chart = HTML('<h1>Hello, world!</h1>')
# or chart = charts.plot(...)
display(chart)
bar()
来源: http://suanfazu.com/t/jupyter-highcharts/13438/2
这篇关于如何在jupyter笔记本中将python字符串显示为HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文