title: Extracting table contents from html with python and BeautifulSoup
body: <p>I want to extract certain information out of an html document. E.g. it contains a table 
  (among other tables with other contents) like this:</p>
  
  <pre><code>    &lt;table class="details"&gt;
              &lt;tr&gt;
                      &lt;th&gt;Advisory:&lt;/th&gt;
                      &lt;td&gt;RHBA-2013:0947-1&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;    
                      &lt;th&gt;Type:&lt;/th&gt;
                      &lt;td&gt;Bug Fix Advisory&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                      &lt;th&gt;Severity:&lt;/th&gt;
                      &lt;td&gt;N/A&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;    
                      &lt;th&gt;Issued on:&lt;/th&gt;
                      &lt;td&gt;2013-06-13&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;    
                      &lt;th&gt;Last updated on:&lt;/th&gt;
                      &lt;td&gt;2013-06-13&lt;/td&gt;
              &lt;/tr&gt;
  
              &lt;tr&gt;
                      &lt;th valign="top"&gt;Affected Products:&lt;/th&gt;
                      &lt;td&gt;&lt;a href="#Red Hat Enterprise Linux ELS (v. 4)"&gt;Red Hat Enterprise Linux ELS (v. 4)&lt;/a&gt;&lt;/td&gt;
              &lt;/tr&gt;
  
  
      &lt;/table&gt;
  </code></pre>
  
  <p>I want to extract Information like the date of "Issued on:". It looks like BeautifulSoup4
  could do this easyly, but somehow I don't manage to get it right.
  My code so far:</p>
  
  <pre><code>    from bs4 import BeautifulSoup
      soup=BeautifulSoup(unicodestring_containing_the_entire_htlm_doc)
      table_tag=soup.table
      if table_tag['class'] == ['details']:
              print table_tag.tr.th.get_text() + " " + table_tag.tr.td.get_text()
              a=table_tag.next_sibling
              print  unicode(a)
              print table_tag.contents
  </code></pre>
  
  <p>This gets me the contents of the first table row, and also a listing of the contents. 
  But the next sibling thing is not working right, I guess I am just using it wrong.
  Of course I could just parse the contents thingy, but it seems to me that beautiful soup
  was designed to prevent us from doing exactly this (if I start parsing myself, I might as
  well parse the whole doc ...). If someone could enlighten me on how to acomplish this, I 
  would be gratefull. If there is a better way then BeautifulSoup, I would be interested to 
  hear about it.</p>