I am using following code to match all div that have CSS class \"ad_item\".
soup.find_all(\'div\',class_=\"ad_item\")
problem that I have i
You can always write a Python function that matches the tag you want, and pass that function into find_all():
def match(tag): return ( tag.name == 'div' and 'ad_item' in tag.get('class') and 'ad_ex_item' not in tag.get('class')) soup.find_all(match)