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

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
Reply
#2
(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.
Reply
#3
Got it. Thank you.
Reply
#4
(Oct-17-2018, 12:34 AM)snippsat Wrote:
(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.

Thanks for sharing this info
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Compare folder A and subfolder B and display files that are in folder A but not in su Melcu54 3 466 Jan-05-2024, 05:16 PM
Last Post: Pedroski55
  IPython errors for numpy array min/max methods muelaner 1 508 Nov-04-2023, 09:22 PM
Last Post: snippsat
  add svg to 2 thread program and display tabel in GUI Nietzsche 5 1,358 May-06-2023, 01:25 PM
Last Post: Nietzsche
  Dynamic pixel display jerryf 2 675 Mar-17-2023, 07:26 PM
Last Post: jerryf
  How to horizontally align and display images side-by-side in an email using Python? shantanu97 0 968 Feb-22-2023, 11:41 PM
Last Post: shantanu97
  Illegal instruction (core dumped) when import pandas. amandacstr 1 1,983 Dec-31-2022, 11:31 PM
Last Post: stevendaprano
  Tkinterweb (Browser Module) Appending/Adding Additional HTML to a HTML Table Row AaronCatolico1 0 877 Dec-25-2022, 06:28 PM
Last Post: AaronCatolico1
  Display value in the another entry field instead of message box adisc 6 1,504 Jun-25-2022, 02:30 PM
Last Post: rob101
  Can a program execute code in iPython shell and get result? deanhystad 3 1,661 Jun-17-2022, 03:45 AM
Last Post: Larz60+
  Write to a LCD display using i2c to a Raspberry Pi using i2c 6398 4x20 LCD Aggie64 4 1,533 Apr-28-2022, 07:26 PM
Last Post: Aggie64

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020