I need to get the values of deeply nested elements <span>in a DOM structure that looks like this:
<div class="panda">
<div class="that">
<ul class="foo">
<li class="bar">
<div class="hi">
<p class="bye">
<span class="cheese">Cheddar</span>
A problem with
soup.findAll("span", {"class": "cheese"})
is that there are hundreds of span elements on the page with the "cheese" class, so I need to filter them by the "panda" class. I need to get a list of values like["Cheddar", "Parmesan", "Swiss"]
source
share