IPython Notebook: rendering a cell as HTML from the contents of a variable

In iPython Notebook, I have a cell where I define a variable (say html ) and assign it html content (the content of the response of the HTTP request). I would like to make this variable in another cell as html. Is it possible? How can i do this?

eg:

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

I would like to do this in the next cell.

Update

I was able to achieve the desired goal:

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

I found a solution here .

More information can be found here .

+6
source share

Source: https://habr.com/ru/post/970692/


All Articles