Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Embedding HTML Code in Python
#5
So my guess was correct,if look at my example code do you not see your error?
Can not just past in HTML code,have to put it in triple quote.
from bs4 import BeautifulSoup

xml = '''\
<lat>
  <latitude>1.123123</latitude>
</lat>'''

soup = BeautifulSoup(xml, 'html.parser')
lat = soup.find('latitude')
print((lat.text)) 
Output:
1.123123
Reply


Messages In This Thread
Embedding HTML Code in Python - by kendias - Jan-27-2019, 12:37 AM
RE: Embedding HTML Code in Python - by metulburr - Jan-27-2019, 01:00 AM
RE: Embedding HTML Code in Python - by snippsat - Jan-27-2019, 01:04 AM
RE: Embedding HTML Code in Python - by kendias - Jan-27-2019, 01:15 AM
RE: Embedding HTML Code in Python - by snippsat - Jan-27-2019, 01:33 AM
RE: Embedding HTML Code in Python - by kendias - Jan-27-2019, 01:43 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Populating list items to html code and create individualized html code files ChainyDaisy 0 1,608 Sep-21-2022, 07:18 PM
Last Post: ChainyDaisy
  HTML multi select HTML listbox with Flask/Python rfeyer 0 4,699 Mar-14-2021, 12:23 PM
Last Post: rfeyer
  Python3 + BeautifulSoup4 + lxml (HTML -> CSV) - How to loop to next HTML/new CSV Row BrandonKastning 0 2,400 Mar-22-2020, 06:10 AM
Last Post: BrandonKastning
  How to get the href value of a specific word in the html code julio2000 2 3,244 Mar-05-2020, 07:50 PM
Last Post: julio2000
  spliting html code with br tag yokaso 11 16,023 Aug-07-2019, 03:18 PM
Last Post: snippsat
  Help with Python and HTML code karlo_ds 4 3,484 Oct-16-2017, 03:03 PM
Last Post: karlo_ds

Forum Jump:

User Panel Messages

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