是否有等值的InnerText在BeautifulSoup / Python的? [英] Is there InnerText equivalent in BeautifulSoup / python?
本文介绍了是否有等值的InnerText在BeautifulSoup / Python的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用以下
soup = BeautifulSoup(page.read(), fromEncoding="utf-8")
result = soup.find('div', {'class' :'flagPageTitle'})
我得到以下HTML:
I get the following html:
<div id="ctl00_ContentPlaceHolder1_Item65404" class="flagPageTitle" style=" ">
<span></span><p>Some text here</p>
</div>
我如何获得写一些文字在这里
无任何标签?是否有等值的InnerText在BeautifulSoup / Python的?
How can I get Some text here
without any tags? Is there InnerText equivalent in BeautifulSoup / python?
推荐答案
所有你需要的是:
result = soup.find('div', {'class' :'flagPageTitle'}).text
这篇关于是否有等值的InnerText在BeautifulSoup / Python的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文