Skip to content Skip to sidebar Skip to footer

Include Multiple Class Names In Findall In Beautifulsoup4

I have a line of code in a python script as shown below for summaries in soup.findAll('div',{'class':'cb-lv-scrs-col cb-font-12 cb-text-complete'}): #do something with summaries H

Solution 1:

I would make a simple CSS selector:

soup.select('div[class="cb-lv-scrs-col cb-font-12 cb-text-complete"],div[class="cb-scag-mtch-status cb-text-inprogress"]')

but, I doubt you really need or should check all of the classes present on an element, would not that be sufficient:

soup.select('div.cb-text-complete,div.cb-text-inprogress')

Post a Comment for "Include Multiple Class Names In Findall In Beautifulsoup4"