赞
踩
find_all(self, name=None, attrs={}, recursive=True, text=None,limit=None, **kwargs)
soup.find_all('title')
[<title>The Dormouse's story</title>]
soup.find_all(id=re.compile("link1"))
[<a class="sister" href="http://example.com/elsie" id="link1">Elsie</a>]
soup.find_all(["title", "a"])
[<title>The Dormouse's story</title>, <a class="sister" href="http://example.com/elsie" id="link1">Elsie</a>, <a class="sister" href="http://example.com/lacie"id="link2">Lacie</a>, <a class="sister" href="http://example.com/tillie" id="link3">Tillie</a>]
soup.find_all(attrs={'id':'link1'})
[<a class="sister" href="http://example.com/elsie" id="link1">Elsie</a>]
soup.html.find_all("head", recursive=False)
[<head><title>The Dormouse's story</title></head>]
soup.find_all(text="Elsie")
['Elsie']
soup.find_all("a", limit=1)
[<a class="sister" href="http://example.com/elsie" id="link1">Elsie</a>]
soup.find_all(id='link3')
[<a class="sister" href="http://example.com/tillie" id="link3">Tillie</a>]
soup.find_all("p", class_="title")
[<p class="title"><b>The Dormouse's story</b></p>]
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。