Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 How to display <IPython.core.display.HTML object>?

I am using Python 3.6.5.

When I run the following code,
from IPython.display import display, HTML

display(HTML('<h1>Hello, world!</h1>'))

I only get: <IPython.core.display.HTML object>

Do I miss something? Wall
(Oct-16-2018, 08:47 PM)pythopen Wrote: Do I miss something?
Yes Jupyter Notebook
You can only render HTML in a browser,and not in a Python console/editor environment.
Can call .data to see html,but it will not render.
In [17]: from IPython.display import display, HTML

In [18]: display(HTML('<h1>Hello, world!</h1>').data)
'<h1>Hello, world!</h1>'
Rich Output examples in Jupyter Notebook.
Got it. Thank you.

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Selection and display of data by combobox LagratteCchouette 8 478 Feb-19-2020, 08:16 PM
Last Post: LagratteCchouette
  How to Display Multiple Time Tables With While Loop ZQ12 2 182 Nov-10-2019, 04:15 AM
Last Post: ZQ12
  How can I create a multiline input in ipython? DataMower 3 236 Oct-28-2019, 08:50 PM
Last Post: DataMower
  def Display Data Invalid Syntax error Linuxdesire 1 263 Oct-11-2019, 05:10 AM
Last Post: stranac
  [split] capitalize dict keys for display in string newbieAuggie2019 3 301 Oct-10-2019, 10:50 AM
Last Post: perfringo
  Need help to display data from a file Dzib 2 246 Sep-26-2019, 04:12 AM
Last Post: Dzib
  HTML to Python to Windows .bat and back to HTML perfectservice33 0 292 Aug-22-2019, 06:31 AM
Last Post: perfectservice33
  ipython autocomplete broke indentation! Exsul 6 761 Aug-20-2019, 01:29 AM
Last Post: Exsul
  NameError: name 'display' is not defined when running code on power bi beginner1 2 2,852 Jul-24-2019, 11:03 AM
Last Post: beginner1
  export file and display cmd prompt same time jacklee26 1 282 Jul-24-2019, 05:15 AM
Last Post: Larz60+

Forum Jump:

Users browsing this thread: 1 Guest(s)