title: BeautifulSoup extracting data from multiple tables
body: <p>I'm trying to extract some data from two html tables in a <a href="https://www.dropbox.com/s/q44hchpbmpzol0t/Html%20sample.txt" rel="nofollow">html file</a> with BeautifulSoup.</p>
  
  <p>This is actually the first time I'm using it and I'searched a lot of questions/example but none seem to work in my case.
  The html contains two tables, the first with the headers of the first column (which are always text) and the second, containing the data of the following columns. Moreover, the table contains text, numbers and also symbols. This makes for a novice like me everything more complicated. <a href="https://www.dropbox.com/s/emeqqn1bqfsfru3/Layout.txt" rel="nofollow">Here's</a> the layout of the html, copied from the browser
  I was able to extract the whole html content of the rows, but only for the first tables, so in reality I am not getting any data but only the content of the first column. </p>
  
  <p>The output I'm trying to obtain is a string containing the "joint" information of the tables (Col1= text, Col2=number, Col3=number, Col4=number, Col5=number), such as:</p>
  
  <pre><code>Canada, 6, 5, 2, 1
  </code></pre>
  
  <p>Here's the list of the Xpaths for each item:</p>
  
  <pre><code>"Canada": /html/body/div/div[1]/table/tbody[2]/tr[2]/td/div/a
  "6": /html/body/div/div[2]/div/table/tbody[2]/tr[2]/td[1] 
  "5": /html/body/div/div[2]/div/table/tbody[2]/tr[2]/td[3] 
  "2": /html/body/div/div[2]/div/table/tbody[2]/tr[2]/td[5]
  "1": /html/body/div/div[2]/div/table/tbody[2]/tr[2]/td[7]
  </code></pre>
  
  <p>I would be also happy with strings in "rough" html format, as long as there is one string per row, so that I'll be able to parse it further with the methods I already know. Here's the code I have so far. Thanks!</p>
  
  <pre><code>from BeautifulSoup import BeautifulSoup
  html=""" 
  my html code
  """
  soup = BeautifulSoup(html)
  table=soup.find("table")
  for row in table.findAll('tr'):
      col = row.findAll('td')
      print row, col
  </code></pre>