1 year ago

#389127

test-img

whoistari

Using soup.select('p > strong'), how do i get the values that are false to the condition?

Given

<p>**44. Best Regional Mexican Music Album (Including Tejano)**<br><em>For albums containing at least 51% playing time of new regional Mexican (banda, norteño, corridos, gruperos, mariachi, ranchera and Tejano) recordings.</em></p>

with the rest of the website's p tags having a strong tag immediately after like so:

<p><strong>45. Best Tropical Latin Album</strong><br><em>For albums containing at least 51% playing time of new tropical Latin recordings.</em></p>

how do I use soup.select('p > strong') in a opposite boolean way such as

from bs4 import BeautifulSoup
soup = BeautifulSoup(htmlfile)
text_without_strong_tag =  not soup.select(p > strong) #and it returns all p tags without strong tags immediately after

python

beautifulsoup

0 Answers

Your Answer

Accepted video resources