Finding attributes of find_all results

16 views
Skip to first unread message

mbod...@u.rochester.edu

unread,
Jan 28, 2018, 8:48:03 AM1/28/18
to beautifulsoup
I've successfully used find_all to find instances that I care about and I am now trying to look at the children of these instances and determine if they meet another criterion.  I have been looking through bs4 documentation and coming up empty, is there some way to do this without using a find/find_all?

Here is essentially what I am trying to do:

for name in soup.find_all('h4', {'class':'item__name'})"
    for child in name.children:
***     if child.class == 'Some class':
            ...

The *** line is what I am trying to replicate
Reply all
Reply to author
Forward
0 new messages