iPython Notebook:将单元格从可变内容渲染为HTML

时间:2014-06-11 09:49:54

标签: jupyter-notebook

在iPython Notebook中我有一个单元格,我在其中定义一个变量(比如html)并为其分配一个html内容(http get请求的响应内容)。我想将此变量作为html呈现到另一个单元格中。可能吗?我该怎么办?

例如:

[1] html = '''<html><h1>a heading</h1><ul><li>one</li><li>two</li><li>three</li></ul></html>'''

我想在下一个单元格中呈现这一点。

1 个答案:

答案 0 :(得分:1)

我能够通过以下方式实现预期目标:

from IPython.display import display, HTML
display(HTML(response.content))

我找到了解决方法here

更多信息here

相关问题