Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 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
Quote
#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.
Quote
#3
Got it. Thank you.
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  display the result of Dataframe in tabulate format alex80 0 123 Sep-09-2020, 02:22 PM
Last Post: alex80
  matplotlib for better waveform display jefflawr 0 195 Aug-14-2020, 01:39 AM
Last Post: jefflawr
  pyautogui with a display emulator? gumby4231 0 123 Jul-30-2020, 02:46 PM
Last Post: gumby4231
  display single elements in array davidm 3 259 Jul-26-2020, 07:32 AM
Last Post: davidm
  Python Module to display Dictionairies for debugging personalt 3 278 Jun-20-2020, 12:39 PM
Last Post: Yoriz
  How to Display a QR code MattLumb 3 326 Jun-02-2020, 01:38 AM
Last Post: MattLumb
  python display with '\\' when prints with key-value in dictionary maiya 12 792 May-30-2020, 05:56 PM
Last Post: maiya
  calling strftime does not display current time tonytech 2 313 May-05-2020, 04:53 AM
Last Post: tonytech
  IPython console vs Spyder script losc 3 424 Apr-30-2020, 04:57 AM
Last Post: deanhystad
  How to display a pdf file arbiel 3 411 Apr-05-2020, 07:03 PM
Last Post: arbiel

Forum Jump:


Users browsing this thread: 1 Guest(s)