I want to select all the divs which have BOTH A and B as class attributes.
The following selection
soup.findAll(\'div\', class_=[\'A\', \'B\'])
Use css selectors instead:
css selectors
soup.select('div.A.B')