soup.find_all() python code example
Example 1: beautiful soup 4
from bs4 import BeautifulSoup
with open("index.html") as fp:
soup = BeautifulSoup(fp)
soup = BeautifulSoup("<html>a web page</html>")
Example 2: beautifulsoup find class
mydivs = soup.findAll("div", {"class": "stylelistrow"})
Example 3: python beautifulsoup find_all
import re
soup.find_all(re.compile("^b")):
soup.find_all('b')
soup.find_all(["a", "b"])
Example 4: soup.find_all attr
british = tabEntry.find(‘div’, class_=’tabs__content on’, attrs={‘data-tab’: ‘ds-british’})business = tabEntry.find(‘div’, class_=’tabs__content on’, attrs={‘data-tab’: ‘ds-business-english’})example = tabEntry.find(‘div’, class_=’tabs__content on’, attrs={‘data-tab’: ‘ds-example’})