import urllib2 from BeautifulSoup import BeautifulSoup # Fetch and parse the data url = 'http://wiki.gnhlug.org/twiki2/bin/view/Www/PastEvents2007?skin=print.pattern' data = urllib2.urlopen(url).read() soup = BeautifulSoup(data) table = soup.table # The first table our_table = [] trs = table.findAll('tr') if 1: our_row = [] for td in trs[0].findAll('th'): text = td.findAll(text=True) text = ''.join(text).strip().encode('utf8') print text our_row.append(text) our_table.append(our_row) for tr in trs[1:]: our_row = [] for td in tr.findAll('td'): text = td.findAll(text=True) text = ''.join(text).strip().encode('utf8') print text our_row.append(text) our_table.append(our_row) import csv out_file = open('/tmp/our_table.csv', 'w') writer = csv.writer(out_file) writer.writerows(our_table) out_file.close()