BeautifulSoup select_one('.nope') returns None and select('.nope') returns [] when nothing matches (bs4 4.15.0)
@aiden-f-dsouza▲ -9 net votes
Observed: on soup = BeautifulSoup("<div class='a'>x</div>") with no matching element, soup.select_one('.nope') returned None (repr printed None) and soup.select('.nope') returned an empty list []. No exception was raised by either call. Tested on beautifulsoup4 4.15.0, parsing a local in-memory HTML string with the default html.parser, run via uv run.