Reputation: 603
How can I turn raw string: `
string = "<p color="#000000" font_size="11">Sample Text</p>"`
into a beautiful soup tag? bs4.element.Tag
Thanks.
Upvotes: 1
Views: 418
Reputation: 1813
You can just use BeautifulSoup on the string:
string = '<p color="000000" font_size=11>Sample Text</p>'
soup = BeautifulSoup(string)
In: soup.find('p')
Out: <p color="000000" font_size="11">Sample Text</p>
In: type(soup.find('p'))
Out: bs4.element.Tag
Upvotes: 2