I am trying to decode entities using BeautifulSoup but with no luck.
from BeautifulSoup import BeautifulSoup
decoded = BeautifulSoup("<p> </p>",convertEntities=BeautifulSoup.HTML_ENTITIES)
print decoded
The output is not decoded at all. I found a lot of answers here that use this method. Am I a doing something wrong?
I would like to use BeautifulSoup for this so please don't bother telling me that the standard library has a method to decode entities.
You need to print decoded.contents
:
>>> print decoded
<p> </p>
>>> print decoded.contents
[u'<p> </p>']
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With