beautifulsoup search for elements with attributes 1

beautifulsoup search for elements with attributes

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

Here is what the above code is Doing:
1. We’re using BeautifulSoup to parse the HTML.
2. We’re using the findAll method to find all the

tags with the valign attribute set to top.
3. We’re storing the results in a variable called results.

Similar Posts