ResultSet
class is a subclass of the list, not the Tag
class , which has find*
methods. The most common method is to loop based on the results of find_all()
:
th_all = soup.find_all('th') result = [] for th in th_all: result.extend(th.find_all(text='A'))
Typically, a CSS selector can help you solve it in one go, except that not everything you can do with find_all()
is possible with select()
. For example, bs4
CSS selectors bs4
not have a βtextualβ search. But, for example, if you needed to find all, say, b
elements inside th
elements, you could do:
soup.select("th td")
source share