Locate a text after an element in BeautifulSoup
Imagine you have the following HTML:
And you need to locate the text "John Smith" after the
In this case, you can locate the
label element by text and then use
pyquery is a jquery-like library for python. It has very well support for css selectors.
Using CSS selectors in BeautifulSoup
BeautifulSoup has a limited support for CSS selectors, but covers most commonly used ones. Use
select() method to find multiple elements and
select_one() to find a single element.
This modified text is an extract of the original Stack Overflow Documentation created by following contributors
and released under CC BY-SA 3.0