Find all the 'h2' tags that are children of a specific div with attribute 'id' and value 'column-left'
<p>Using BeautifulSoup, I tried the following:</p>

<pre><code>q =  soup.div.find_all("div", { "id" : "column-left" }, "h2")
</code></pre>

<p>But this gives me the text of the <code>&lt;p&gt;</code> as well. I just want the h2 that are children of a specific div.</p>

<p>Why are you accessing <code>soup.div</code>?</p>

<p>Try this:</p>

<pre><code>q =  soup.find('div', { 'id' : 'column-left' }).find_all('h2')
</code></pre>

<p>Also find_all has optional parameter 'id', so you do not have to write attributes map</p>

<pre><code>q =  soup.find('div', id='column-left').find_all('h2')
</code></pre>

python web-scraping beautifulsoup