python BeautifulSoup怎么获取无标签文本?


<p>aaa</p>bbb
<p>ccc</p>ddd

怎么获取bbb和ddd呢?

python beautifulsoup

某龙。。 10 years, 11 months ago

可以使用findAll()的text参数。

text is an argument that lets you search for NavigableString objects instead of Tags. Its value can be a string, a regular expression, a list or dictionary, True or None, or a callable that takes a NavigableString object as its argument:

详细请见文档findAll部分:
http://www.crummy.com/software/Beauti...

Lotiel answered 10 years, 11 months ago

Your Answer