In Beautifulsoup i receive a list of divs. Each of these divs has an span included:
<div role="news_item" class="ni_nav_9tg">
<span class="nav_element_new_S5g">Germany vs. Japan</span>
</div>
...
<div role="news_item" class="ni_nav_9tg">
<span class="nav_element_new_S5g">Brasil vs. Serbia</span>
</div>
What i want is to check if in this list of div a span exist whose class contains string "new". Just true or false as result.
Of course i could iterate through each item div in list and get span item after this check if class contains string "new", but i am not sure if this is the right approach.
source https://stackoverflow.com/questions/74576984/how-to-checkin-list-of-divs-if-there-is-a-span-within-with-class-new
Comments
Post a Comment