gazpacho logo gazpacho: strict

1 2 3 4 5 6
Notes

Let's check the website parsing code once more. You can grab all the cards from the website with this code.

url = "https://pypi.org/project/pandas/#history"

from gazpacho import get, Soup
html = get(url)
soup = Soup(html)
cards = soup.find("a", {"class": "card"})

To parse the cards properly it helps to understand the partial parameter. If we set partial=False then we don't allow elements that only match the "release__version" partially. That means that the following code gives us a single element.

cards[0].find("p", {"class": "release__version"}, partial=False)

If we set partial=True then we do don't allow elements that have "release__version" as a substring. That means that the following code gives us a list.

cards[0].find("p", {"class": "release__version"}, partial=True)