Reputation: 22021
How can I output an IPython HTML object of the form <IPython.core.display.HTML object>
to a HTML file or PDF file on disk?
Upvotes: 6
Views: 9825
Reputation: 17074
You can do something like this:
from IPython.core.display import HTML
a = HTML('<a href="http://example.com">LINK TO THE WEB PAGE</a>')
html = a.data
with open('html_file.html', 'w') as f:
f.write(html)
Upvotes: 11