BeautifulSoup 中有等效的 InnerText 吗?

2024-01-01

使用下面的代码:

soup = BeautifulSoup(page.read(), fromEncoding="utf-8")
result = soup.find('div', {'class' :'flagPageTitle'})

我得到以下 html:

<div id="ctl00_ContentPlaceHolder1_Item65404" class="flagPageTitle" style=" ">
<span></span><p>Some text here</p>
</div>

我怎样才能得到Some text here没有任何标签?是否有等效的 InnerTextBeautifulSoup?


所有你需要的是:

result = soup.find('div', {'class' :'flagPageTitle'}).text
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

BeautifulSoup 中有等效的 InnerText 吗? 的相关文章

随机推荐