title: Parsing HTML Tables with BeautifulSoup
body: <p>I have used BeautifulSoup in the past but I am up against something new; incredibly generic/minimal HTML table markup... My goal is to grab each value and it's label (each in there own td) and print them out... They can be merged, I don't care, I just want to make sure each label is applied to the correct value. Here is an example table:</p>
  
  <pre><code>&lt;tbody&gt;&lt;tr&gt;
  &lt;td class="labels"&gt;Dawn:&lt;/td&gt;
  &lt;td class="site_data" style="text-align: left;"&gt;07:01&lt;/td&gt;
  &lt;td class="labels"&gt;Sunrise:&lt;/td&gt;
  &lt;td class="site_data" style="text-align: left;"&gt;07:26&lt;/td&gt;
  &lt;td class="labels"&gt;Moonrise:&lt;/td&gt;
  &lt;td class="site_data" style="text-align: left;"&gt;14:29&lt;/td&gt;
  &lt;td rowspan="3"&gt;&lt;img src="images/moon.bmp" alt="Moon" width="64" align="left" border="0" height="64" style="margin: 0px 10px" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td class="labels"&gt;Dusk:&lt;/td&gt;
  &lt;td class="site_data" style="text-align: left;"&gt;18:27&lt;/td&gt;
  &lt;td class="labels"&gt;Sunset:&amp;nbsp;&lt;/td&gt;
  &lt;td class="site_data" style="text-align: left;"&gt;18:02&lt;/td&gt;
  &lt;td class="labels"&gt;Moonset:&lt;/td&gt;
  &lt;td class="site_data" style="text-align: left;"&gt;01:55&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td class="labels"&gt;Daylight:&lt;/td&gt;
  &lt;td class="site_data" style="text-align: left;"&gt;11:26&lt;/td&gt;
  &lt;td class="labels"&gt;Day length:&lt;/td&gt;
  &lt;td class="site_data" style="text-align: left;"&gt;10:36&lt;/td&gt;
  &lt;td class="labels"&gt;Moon Phase:&lt;/td&gt;
  &lt;td class="site_data" style="text-align: left;"&gt;Waxing Gibbous&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/tbody&gt;
  </code></pre>
  
  <p>I know how to grab these values...</p>
  
  <pre><code>for td in soup.findAll('table')[0]:  # theres more than one table on the page
      print td.renderContents().strip()
  </code></pre>
  
  <p>but this only gives me....</p>
  
  <pre><code>'Dawn:'
  '07:01'
  'Sunrise:'
  '07:26'
  'Moonrise:'
  '14:29'
  '&lt;img src="images/moon.bmp" alt="Moon" width="64" align="left" border="0" height="64" style="margin: 0px 10px" /&gt;'
  'Dusk:'
  '18:27'
  'Sunset:&amp;nbsp;'
  '18:02'
  'Moonset:'
  '01:55'
  'Daylight:'
  '11:26'
  'Day length:'
  '10:36'
  'Moon Phase:'
  'Waxing Gibbous'
  </code></pre>
  
  <p>I guess I could grab onto those class values "labels" and "site_data" but how do I make sure the labels and data are grouped correctly?</p>