title: Reading table using BeautifulSoup
body: <p>I'm reading an HTML file with BeautifulSoup. I have a table in the HTML from which I need to read data, but the HTML contains more than one table. 
  To distinguish between the tables, I need to see the number of columns on each line by counting <code>&lt;td&gt;</code> tags.</p>
  
  <p>I count like this:</p>
  
  <pre><code>for i in soup.find_all('tr'):
      for x in i.findallnext('td'):
  </code></pre>
  
  <p>This returns all <code>&lt;td&gt;</code> tags after the <code>&lt;tr&gt;</code> until the end of the document. But I need to know the numbers of <code>&lt;td&gt;</code> tags between the start of a line (<code>&lt;tr&gt;</code>) and the and of that line (<code>&lt;/tr&gt;</code>).</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;tr&gt; &lt;!-- Should return 2 columns, but will return 4 in script. --&gt;
      &lt;td&gt;&lt;/td&gt;
      &lt;td&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;&lt;/td&gt;
      &lt;td&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>