Python Forum
Preserving anchor tags in BeautifulSoup
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Preserving anchor tags in BeautifulSoup
#6
Hi :)

Here is maybe a better example: https://www.thesite.com/api.php?getProjectsToAction=1

That URL contains xml content, when i get this part:

<taskBody>This is a &lt;a href=&quot;https://www.test.com/&quot;&gt;test&lt;/a&gt; using html tags.</taskBody>
Via Python using BeautifulSoup, the entire string including the ahref is not showing in the console as: This is a <a href="https://www.test.com/">test</a> using html tags. instead it shows as This is a test using html tags.

if i use get_text() it strips out all html tags (so i read somewhere) so it shouldn't strip the html do you think? :)

thank you for the help!
Reply


Messages In This Thread
RE: Preserving anchor tags in BeautifulSoup - by graham23s - May-19-2019, 06:42 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  BeautifulSoup - I can't translate html tags that contain <a href=..</a> OR <em></em> Melcu54 10 1,736 Oct-27-2022, 08:58 AM
Last Post: wavic
  Loop through tags inside tags in Selenium/Python xpack24 1 5,735 Oct-23-2019, 10:15 AM
Last Post: Larz60+
  remove tags from BeautifulSoup result moski 1 4,727 Jun-05-2019, 01:47 PM
Last Post: heiner55

Forum Jump:

User Panel Messages

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