title: BeautifulSoup / Python - Convert HTML table to CSV and get href for one column
body: <p>I am grabbing an HTML table with this code :</p>
  
  <pre><code>import csv
  import urllib2
  from bs4 import BeautifulSoup
  
  with open('listing.csv', 'wb') as f:
      writer = csv.writer(f)
      for i in range(39):
          url = "file:///C:/projects/HTML/Export.htm".format(i)
          u = urllib2.urlopen(url)
          try:
              html = u.read()
          finally:
              u.close()
          soup=BeautifulSoup(html)
          for tr in soup.find_all('tr')[2:]:
              tds = tr.find_all('td')
              row = [elem.text.encode('utf-8') for elem in tds]
              writer.writerow(row)
  </code></pre>
  
  <p>Everything works perfectly, but I am trying to grab column 9 Href URL. It is currently giving me the txt value but not the URL.</p>
  
  <p>Also, I have two tables in my HTML, anyway to skip the first table and just build the csv file using the second table?</p>
  
  <p>Any help is very welcomed as I am new to Python and need this for a project I am automating a daily conversion.</p>
  
  <p>Many thanks!</p>