findall on parent child tags

125 views
Skip to first unread message

goldtech

unread,
Aug 1, 2014, 2:38:16 AM8/1/14
to beauti...@googlegroups.com
Hi,

This must be simple but I'm not seeing it:

Say within a soup of HTML there's <li><strong>some text</strong></li>

I want to do a find_all that will find it and extract the text.

Of course find_all('li') works but there must be a way to specify finding  parent child combinations.

I would be grateful if someone could show me that syntax.

Thanks, using bs4

Aaron DeVore

unread,
Aug 1, 2014, 1:00:53 PM8/1/14
to beauti...@googlegroups.com
Beautiful Soup's CSS selector support might be a good match for your use case.

See: http://www.crummy.com/software/BeautifulSoup/bs4/doc/#css-selectors

-Aaron DeVore


--
You received this message because you are subscribed to the Google Groups "beautifulsoup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beautifulsou...@googlegroups.com.
To post to this group, send email to beauti...@googlegroups.com.
Visit this group at http://groups.google.com/group/beautifulsoup.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages