7

In iPython Notebook I have a cell where I define a variable (say html) and assign to it an html content (response content of a http get request). I would like to render this variable into another cell as html. Is it possible? How can I do it?

eg:

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

I would like to render this in the next cell.

0

1 Answer 1

2

I was able to achieve the desired goal by:

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

I found the solution here.

More info can be found here.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.