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
  How to Display a QR code MattLumb 3 139 Today, 01:38 AM
Last Post: MattLumb
  python display with '\\' when prints with key-value in dictionary maiya 12 369 May-30-2020, 05:56 PM
Last Post: maiya
  calling strftime does not display current time tonytech 2 160 May-05-2020, 04:53 AM
Last Post: tonytech
  IPython console vs Spyder script losc 3 223 Apr-30-2020, 04:57 AM
Last Post: deanhystad
  How to display a pdf file arbiel 3 241 Apr-05-2020, 07:03 PM
Last Post: arbiel
  Selection and display of data by combobox LagratteCchouette 10 727 Mar-02-2020, 06:34 PM
Last Post: ibreeden
  Time SQL Statement & Display Total anelliaf 0 170 Feb-28-2020, 05:55 PM
Last Post: anelliaf
  How to Display Multiple Time Tables With While Loop ZQ12 2 276 Nov-10-2019, 04:15 AM
Last Post: ZQ12
  How can I create a multiline input in ipython? DataMower 3 550 Oct-28-2019, 08:50 PM
Last Post: DataMower
  def Display Data Invalid Syntax error Linuxdesire 1 366 Oct-11-2019, 05:10 AM
Last Post: stranac

Forum Jump:

Users browsing this thread: 1 Guest(s)