Python: Counting URL in a specific class
<p>I would like to count URLs in a specific class.
the class which is </p>

<pre><code>&lt;h1 class="sectionTitle"&gt;INSIDERS AT LOEWS CORP (L)&lt;/h1&gt;
</code></pre>

<p>have some links like </p>

<pre><code>&lt;a href="../../../research/stocks/people/relationship.asp?personId=228893&amp;symbol=L:US"&gt;
</code></pre>

<p>I would like to count the number of this kind of links under only this class. 
This is my program, but when I wrote "count" it doesn't work. </p>

<pre><code>i = 0
headings = bs.find('h1', text='INSIDERS AT LOEWS CORP (L)')
for section2 in headings.findNext(''):
    aa= section2.findAll('a', {'href': True})
    bb=aa.count('href')
    print bb
i = i + 1;
</code></pre>

<p>it doesn't work..... would you mind giving me a tip to solve the issue???
Thank you so much!</p>

<pre><code>&lt;h1 class="sectionTitle"&gt;INSIDERS AT LOEWS CORP (L)&lt;/h1&gt;
&lt;table cellpadding="0" cellspacing="0" class="table" width="100%" style="margin-bottom:5px;"&gt;&lt;thead&gt;&lt;tr&gt;&lt;td&gt;Name (Connections)&lt;/td&gt;&lt;td colspan="2" style="width:120px;"&gt;Board Relationships&lt;/td&gt;&lt;td&gt;Title&lt;/td&gt;&lt;td&gt;Type of Board Member&lt;/td&gt;&lt;td align="right"&gt;Age&lt;/td&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tr&gt;&lt;td&gt;&lt;a href="../../../research/stocks/people/person.asp?personId=228893&amp;symbol=L:US" class="link_xsb"&gt;Andrew Tisch  &lt;/a&gt;&lt;/td&gt;&lt;td style="width:28px; padding-left: 5px;"&gt;&lt;a href="../../../research/stocks/people/relationship.asp?personId=228893&amp;symbol=L:US"&gt;&lt;img src="../../images/icons/people2.gif" style="vertical-align:middle" / &gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt; &lt;strong&gt;&lt;a href="/businessweek/research/stocks/people/relationship.asp?personId=228893&amp;symbol=L:US"&gt;53&lt;/strong&gt; Relationships&lt;/a&gt;&lt;/td&gt;&lt;td style="width:200px"&gt;Co-Chairman, Member of the Office of the President, Chairman of Executive Committee, Member of Finance Committee and Chairman of Bulova&lt;/td&gt;&lt;td &gt;--&lt;/td&gt;&lt;td align="right" style="width:20px"&gt;61&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href="../../../research/stocks/people/person.asp?personId=285942&amp;symbol=L:US" class="link_xsb"&gt;Jonathan Tisch  &lt;/a&gt;&lt;/td&gt;&lt;td style="width:28px; padding-left: 5px;"&gt;&lt;a href="../../../research/stocks/people/relationship.asp?personId=285942&amp;symbol=L:US"&gt;&lt;img src="../../images/icons/people2.gif" style="vertical-align:middle" / &gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt; &lt;strong&gt;&lt;a href="/businessweek/research/stocks/people/relationship.asp?personId=285942&amp;symbol=L:US"&gt;56&lt;/strong&gt; Relationships&lt;/a&gt;&lt;/td&gt;&lt;td style="width:200px"&gt;Co-Chairman, Member of the Office of the President, Member of Executive Committee, Chairman of Loews Hotels and Chief Executive Officer of Loews Hotels&lt;/td&gt;&lt;td &gt;--&lt;/td&gt;&lt;td align="right" style="width:20px"&gt;57&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href="../../../research/stocks/people/person.asp?personId=285936&amp;symbol=L:US" class="link_xsb"&gt;James Tisch  &lt;/a&gt;&lt;/td&gt;&lt;td style="width:28px; padding-left: 5px;"&gt;&lt;a href="../../../research/stocks/people/relationship.asp?personId=285936&amp;symbol=L:US"&gt;&lt;img src="../../images/icons/people3.gif" style="vertical-align:middle" / &gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt; &lt;strong&gt;&lt;a href="/businessweek/research/stocks/people/relationship.asp?personId=285936&amp;symbol=L:US"&gt;240&lt;/strong&gt; Relationships&lt;/a&gt;&lt;/td&gt;&lt;td style="width:200px"&gt;Chief Executive Officer, President, Member of Office of the President, Director, Member of Executive Committee, Member of Finance Committee, Chairman of Diamond Offshore and Director of CNA&lt;/td&gt;&lt;td &gt;--&lt;/td&gt;&lt;td align="right" style="width:20px"&gt;58&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
</code></pre>
