Skip to content Skip to sidebar Skip to footer

Beautifulsoup Error Handling When Find Returns Nonetype

I am scraping search results from a website where each result is contained in a and has a range of data associated with it. However some of these data values are missing and when

Solution 1:

for example:

item_eng = div.find("li", "item-engine").text if div.find("li", "item-engine") else''

or:

item_eng = div.find("li", "item-engine").text iflen(div.find_all("li", "item-engine"))!=0else''

Post a Comment for "Beautifulsoup Error Handling When Find Returns Nonetype"