I am trying to find all p tags with the class column.
<p class="column">This is a column</p>
<p class="column">More columns heh</p>
I tried doing:
soup.find_all(class_='column')
which returned []
Then I tried:
soup.find_all(attrs={'class': 'column'})
and got the right results.
Shouldn’t these two statements be identical? What’s the difference?
The statements are exactly identical, and I was not able to reproduce your problem:
Note that the
class_argument was introduced in version 4.1.2, so do make sure you use a recent version of BeautifulSoup. From the Searching by CSS class section: