我正在使用Beautiful Soup 3解析一些HTML,但它包含了HTML实体,而Beautiful Soup 3没有自动对其进行解码:
>>> from BeautifulSoup import BeautifulSoup
>>> soup = BeautifulSoup("<p>£682m</p>")
>>> text = soup.find("p").string
>>> print text
£682m
我该如何解码text
中的HTML实体,以便得到"£682m"
而不是"£682m"
。