diff options
author | Leonard Richardson <leonardr@segfault.org> | 2015-06-25 21:41:23 -0400 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2015-06-25 21:41:23 -0400 |
commit | fc32a6eb0fe0e981b4f41362b97576099b8c4a4e (patch) | |
tree | d2a9dd7ec7b805351b83c4fc6126e3887f9253d9 /doc | |
parent | b61a9c8bcd73d7b6f1fca064079ef87441fefad5 (diff) | |
download | beautifulsoup4-fc32a6eb0fe0e981b4f41362b97576099b8c4a4e.tar.gz |
Introduced the select_one() method, which uses a CSS selector but
only returns the first match, instead of a list of
matches. [bug=1349367]
Diffstat (limited to 'doc')
-rw-r--r-- | doc/source/index.rst | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/doc/source/index.rst b/doc/source/index.rst index d35481e..1b7b1e6 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -1735,6 +1735,10 @@ Match language codes:: # <p lang="en-us">Howdy, y'all</p>, # <p lang="en-gb">Pip-pip, old fruit</p>] +Find only the first tag that matches a selector:: + + soup.select_one(".sister") + # <a class="sister" href="http://example.com/elsie" id="link1">Elsie</a> This is all a convenience for users who know the CSS selector syntax. You can do all this stuff with the Beautiful Soup API. And if CSS |