title: BeautifulSoup scraping nested tables
body: <p>I have been trying to scrape the data from a website which is using a good amount of tables.  I have been researching on the beautifulsoup documentation as well as here on stackoverflow but am still lost.  </p>
  
  <p>Here is the said table:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>      &lt;form action="/rr/" class="form"&gt;
          &lt;table border="0" width="100%" cellpadding="2" cellspacing="0" align="left"&gt;
            &lt;tr bgcolor="#6699CC"&gt;
              &lt;td valign="top"&gt;&lt;font face="arial"&gt;&lt;b&gt;Uesless Data&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
      
              &lt;td width="10%"&gt;&lt;br /&gt;&lt;/td&gt;
      
              &lt;td align="right"&gt;&lt;font face="arial"&gt;Uesless Data&lt;/font&gt;&lt;/td&gt;
            &lt;/tr&gt;
      
            &lt;tr bgcolor="#DCDCDC"&gt;
              &lt;td&gt; &lt;input size="12" name="s" value="data:" onfocus=
              "this.value = '';" /&gt; &lt;input type="hidden" name="d" value="research" /&gt;
          
              &lt;input type="submit" value="Date" /&gt;&lt;/td&gt;
      
              &lt;td width="10%"&gt;&lt;br /&gt;&lt;/td&gt;
      
            &lt;/tr&gt;
          &lt;/table&gt;
        &lt;/form&gt;
      
        &lt;table border="0" width="100%"&gt;
          &lt;tr&gt;
            &lt;td&gt;&lt;/td&gt;
          &lt;/tr&gt;
        &lt;/table&gt;&lt;br /&gt;
        &lt;br /&gt;
      
        &lt;table border="0" width="100%"&gt;
          &lt;tr&gt;
            &lt;td valign="top" width="99%"&gt;
              &lt;table cellpadding="2" cellspacing="0" border="0" width="100%"&gt;
                &lt;tr bgcolor="#A0B8C8"&gt;
                  &lt;td colspan="6"&gt;&lt;b&gt;Data to be pulled&lt;/b&gt;&lt;/td&gt;
                &lt;/tr&gt;
      
                &lt;tr bgcolor="#DCDCDC"&gt;
                  &lt;td&gt;&lt;font face="arial"&gt;&lt;b&gt;Data to be pulled&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
      
                  &lt;td&gt;&lt;font face="arial"&gt;&lt;b&gt;Data to be pulled&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
      
                  &lt;td align="center"&gt;&lt;font face="arial"&gt;&lt;b&gt;Data to be pulled
                  &lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
      
                  &lt;td align="center"&gt;&lt;font face="arial"&gt;&lt;b&gt;Data to be pulled
                  &lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
      
                  &lt;td align="center"&gt;&lt;font face="arial"&gt;&lt;b&gt;Data to be pulled
                  &lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
      
                  &lt;td align="center"&gt;&lt;font face="arial"&gt;&lt;b&gt;Data to be pulled
                  &lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
                &lt;/tr&gt;
      
                &lt;tr&gt;
                  &lt;td&gt;Data to be pulled&lt;/td&gt;
      
                  &lt;td align="center"&gt;Data to be pulled&lt;/td&gt;
      
                  &lt;td align="center"&gt;Data to be pulled&lt;/td&gt;
      
                  &lt;td align="center"&gt;Data to be pulled&lt;/td&gt;
      
                  &lt;td align="center"&gt;&lt;br /&gt;&lt;/td&gt;
                &lt;/tr&gt;
           &lt;/table&gt;
         &lt;/td&gt;
       &lt;/tr&gt;
        &lt;/table&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>There are quite a few tables, and none of which really have any distinguishing id's or tags.  My most recent attempt was:</p>
  
  <pre><code>table = soup.find('table', attrs={'border':'0', 'width': "100%'})
  </code></pre>
  
  <p>Which is pulling only the first empty table.  I feel like the answer is simple, and I am over thinking it.</p>