diff options
author | Leonard Richardson <leonardr@segfault.org> | 2013-05-07 12:24:38 -0400 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2013-05-07 12:24:38 -0400 |
commit | 7be8a3961be3a7f4ebee46eed3ef3a1372cef532 (patch) | |
tree | b03473bec90e6c4615aef06cfaaf4af050806ccb /doc/source | |
parent | 716ef11451f833227b5ba30b4324335e057c4e52 (diff) |
Mentioned the CSS selector solution to searching for a tag by multiple CSS classes.
Diffstat (limited to 'doc/source')
-rw-r--r-- | doc/source/index.rst | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/doc/source/index.rst b/doc/source/index.rst index 03d4824..79286ab 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -1266,6 +1266,12 @@ But searching for variants of the string value won't work:: css_soup.find_all("p", class_="strikeout body") # [] +If you want to search for tags that match two or more CSS classes, you +should use a CSS selector:: + + css_soup.select("p.strikeout.body") + # [<p class="body strikeout"></p>] + There's a shortcut for ``class_`` present in all versions of Beautiful Soup. The second argument to any ``find()``-type method is called ``attrs``, and passing in a string for ``attrs`` will search for that |