From ad9e588d54561ed929e89b3433e75388e45366ae Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Sun, 11 Dec 2016 10:24:58 -0500 Subject: Show how to use the attrs argument to search by the 'name' attribute. [bug=1639580] --- doc/source/index.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'doc/source/index.rst') diff --git a/doc/source/index.rst b/doc/source/index.rst index 654a3a4..cd1ab2f 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -1262,6 +1262,16 @@ dictionary and passing the dictionary into ``find_all()`` as the data_soup.find_all(attrs={"data-foo": "value"}) # [
foo!
] +Similarly for HTML's 'name' attribute, which you can't use as a +keyword argument because Beautiful Soup uses the ``name`` argument to +contain the name of the tag itself. + + name_soup = BeautifulSoup('') + name_soup.find_all(name="email") + # [] + name_soup.find_all(attrs={"name": "email"}) + # [] + .. _attrs: Searching by CSS class -- cgit v1.2.3