1👍
✅
To find a
elements with a class=fl
attribute, you call find_all
like this:
getAdditionalGooglePages = beautifulSoupObj.find_all('a', attrs={"class": "fl"})
For other attributes, it’s simpler – for example, with id=fl
it would be:
getAdditionalGooglePages = beautifulSoupObj.find_all('a', id="fl")
… but that doesn’t work with class
, because it’s a Python reserved word.
Source:stackexchange.com