title: Extracting tables from a webpage using BeautifulSoup 4
body: <p>Be forgiving, only started using beautifulSoup today to deal with this problem.</p>
  
  <p>I've managed to get it working by dragging in the URL's on the website, Each of the product pages on this website has a table that looks like the following:</p>
  
  <pre><code>&lt;table width="100%" class="product-feature-table"&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td align="center"&gt;&lt;table cellspacing="0" class="stats2"&gt;
          &lt;tbody&gt;
            &lt;tr&gt;
            &lt;td class="hed" colspan="2"&gt;YYF Shutter Stats:&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
            &lt;td&gt;Diameter:&lt;/td&gt;
            &lt;td&gt;56 mm / 2.20 inches&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
              &lt;td&gt;Width:&lt;/td&gt;
              &lt;td&gt;44.40 mm / 1.74 inches&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
              &lt;td&gt;Gap Width:&lt;/td&gt;
              &lt;td&gt;4.75 mm / .18 inches&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
              &lt;td&gt;Weight:&lt;/td&gt;
              &lt;td&gt;67.8 grams&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
              &lt;td&gt;Bearing Size:&lt;/td&gt;
              &lt;td&gt;Size C (.250 x .500 x .187)&lt;br&gt;CBC SPEC Bearing&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
              &lt;td&gt;Response:&lt;/td&gt;
              &lt;td&gt;CBC Silicone Slim Pad (19mm)&lt;/td&gt;
            &lt;/tr&gt;
          &lt;/tbody&gt;
          &lt;/table&gt;
        &lt;br&gt;
        &lt;br&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I'm trying to pull this table into some form of data that I could work with within a webapp.</p>
  
  <p>How would I go about extracting this from each webpage, the website has around 400 product pages that include this table, I'd preferably like to get each of the tables from the page and put it into a database entry or text file with the name of the product.</p>
  
  <p>As you can see the table isn't exactly formatted well, but it is the only table on the page labeled with</p>
  
  <pre><code>class="product-feature-table"
  </code></pre>
  
  <p>I have just been trying to edit a URL scraping script but I'm starting to get the feeling I'm going about it all wrong trying to do that. </p>
  
  <p>My url script is as follows: </p>
  
  <pre><code>import urllib2
  from bs4 import BeautifulSoup
  
  url = raw_input('Web-Address: ')
  
  html = urllib2.urlopen('http://' +url).read()
  soup = BeautifulSoup(html)
  soup.prettify()
  for anchor in soup.findAll('a', href=True):
      print anchor['href']
  </code></pre>
  
  <p>I can get all these URL's into a text file but would much prefer to use Sqlite or Postgresql, are there any articles online that would help me understand these concepts better, that don't drown the newbie?</p>