标签: python-2.7 beautifulsoup
HTML:
<div class="person" age="52"</div>
我想用bs4
我试过了:
soup = BeautifulSoup(source, "lxml") #source is the page.text age = soup.find("div", { "class": "person" })["age"]
但是每次运行时,我都会得到一个None值,好像该元素不存在一样。