bs4 find by attribute code example

Example 1: beautifulsoup search for elements with attributes

soup = BeautifulSoup(html)
results = soup.findAll("td", {"valign" : "top"})

Example 2: 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’})