find_all () Brief description:
find_all()
find_all () method searches all child nodes of the current tag of the tag, and determines whether the conditions of the filter
Use a:
rs=soup.find_all('a')
Soup will return all of the content hyperlinks
There are similar rs.find_all ( 'span'), rs.find_all ( 'title'), rs.find_all ( 'h1')
Can be added to the search criteria, eg:
rs.find_all('img',{'class':'news-img'})
We will return all of the class attribute of the img content of news-img
Usage of Two:
true here refers to select all tags have the id attribute
soup.find_all(id=True)
Return result:
[<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>]
Use three:
soup.find_all("a", string="Elsie")
Soso can string contents of the document by the string parameters. As with the optional parameter value name, string parameter accepts strings, regular expressions, lists, True
Usage four:
soup.find_all("a", limit=2)
Limit is the number of lookups to find the number here twice