May-18-2019, 07:54 PM
Hi Guys,
After testing my code i found out the BeautifulSoup strips html tags when using: get_text()
i'm getting data from an .xml file:
regards
Graham
After testing my code i found out the BeautifulSoup strips html tags when using: get_text()
i'm getting data from an .xml file:
xml_content_body = soup.find('taskBody')This field contains text with anchor text in it, like:
word word word <a href="https://www.thesite.com/">work</a> word etcIs there a way to keep the html tags instead of stripping them with get_text()?
# beautifulsoup setup soup = BeautifulSoup(projects.text, 'xml') # xml values xml_content_body = soup.find('taskBody')I cannot see a way to do this, any help would be appreciated guys!
regards
Graham