From 7be8a3961be3a7f4ebee46eed3ef3a1372cef532 Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Tue, 7 May 2013 12:24:38 -0400 Subject: Mentioned the CSS selector solution to searching for a tag by multiple CSS classes. --- doc/source/index.rst | 6 ++++++ 1 file changed, 6 insertions(+) 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") + # [

] + 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 -- cgit v1.2.3