title: beautifulSoup html csv
body: <p>Good evening, I have used BeautifulSoup to extract some data from a website as follows:</p>
  
  <pre><code>from BeautifulSoup import BeautifulSoup
  from urllib2 import urlopen
  
  soup = BeautifulSoup(urlopen('http://www.fsa.gov.uk/about/media/facts/fines/2002'))
  
  table = soup.findAll('table', attrs={ "class" : "table-horizontal-line"})
  
  print table
  </code></pre>
  
  <p>This gives the following output:</p>
  
  <pre><code>[&lt;table width="70%" class="table-horizontal-line"&gt;
  &lt;tr&gt;
  &lt;th&gt;Amount&lt;/th&gt;
  &lt;th&gt;Company or person fined&lt;/th&gt;
  &lt;th&gt;Date&lt;/th&gt;
  &lt;th&gt;What was the fine for?&lt;/th&gt;
  &lt;th&gt;Compensation&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;&lt;a name="_Hlk74714257" id="_Hlk74714257"&gt;&amp;#160;&lt;/a&gt;£4,000,000&lt;/td&gt;
  &lt;td&gt;&lt;a href="/pages/library/communication/pr/2002/124.shtml"&gt;Credit Suisse First Boston International &lt;/a&gt;&lt;/td&gt;
  &lt;td&gt;19/12/02&lt;/td&gt;
  &lt;td&gt;Attempting to mislead the Japanese regulatory and tax authorities&lt;/td&gt;
  &lt;td&gt;&amp;#160;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;£750,000&lt;/td&gt;
  &lt;td&gt;&lt;a href="/pages/library/communication/pr/2002/123.shtml"&gt;Royal Bank of Scotland plc&lt;/a&gt;&lt;/td&gt;
  &lt;td&gt;17/12/02&lt;/td&gt;
  &lt;td&gt;Breaches of money laundering rules&lt;/td&gt;
  &lt;td&gt;&amp;#160;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;£1,000,000&lt;/td&gt;
  &lt;td&gt;&lt;a href="/pages/library/communication/pr/2002/118.shtml"&gt;Abbey Life Assurance Company ltd&lt;/a&gt;&lt;/td&gt;
  &lt;td&gt;04/12/02&lt;/td&gt;
  &lt;td&gt;Mortgage endowment mis-selling and other failings&lt;/td&gt;
  &lt;td&gt;Compensation estimated to be between £120 and £160 million&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;£1,350,000&lt;/td&gt;
  &lt;td&gt;&lt;a href="/pages/library/communication/pr/2002/087.shtml"&gt;Royal &amp;#38; Sun Alliance Group&lt;/a&gt;&lt;/td&gt;
  &lt;td&gt;27/08/02&lt;/td&gt;
  &lt;td&gt;Pension review failings&lt;/td&gt;
  &lt;td&gt;Redress exceeding £32 million&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;£4,000&lt;/td&gt;
  &lt;td&gt;&lt;a href="/pubs/final/ft-inv-ins_7aug02.pdf" target="_blank"&gt;F T Investment &amp;#38; Insurance Consultants&lt;/a&gt;&lt;/td&gt;
  &lt;td&gt;07/08/02&lt;/td&gt;
  &lt;td&gt;Pensions review failings&lt;/td&gt;
  &lt;td&gt;&amp;#160;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;£75,000&lt;/td&gt;
  &lt;td&gt;&lt;a href="/pubs/final/spe_18jun02.pdf" target="_blank"&gt;Seymour Pierce Ellis ltd&lt;/a&gt;&lt;/td&gt;
  &lt;td&gt;18/06/02&lt;/td&gt;
  &lt;td&gt;Breaches of FSA Principles ("skill, care and diligence" and "internal organization")&lt;/td&gt;
  &lt;td&gt;&amp;#160;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;£120,000&lt;/td&gt;
  &lt;td&gt;&lt;a href="/pages/library/communication/pr/2002/051.shtml"&gt;Ward Consultancy plc&lt;/a&gt;&lt;/td&gt;
  &lt;td&gt;14/05/02&lt;/td&gt;
  &lt;td&gt;Pension review failings&lt;/td&gt;
  &lt;td&gt;&amp;#160;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;£140,000&lt;/td&gt;
  &lt;td&gt;&lt;a href="/pages/library/communication/pr/2002/036.shtml"&gt;Shawlands Financial Services ltd&lt;/a&gt; - formerly Frizzell Life &amp;#38; Financial Planning ltd)&lt;/td&gt;
  &lt;td&gt;11/04/02&lt;/td&gt;
  &lt;td&gt;Record keeping and associated compliance breaches&lt;/td&gt;
  &lt;td&gt;&amp;#160;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;£5,000&lt;/td&gt;
  &lt;td&gt;&lt;a href="/pubs/final/woodwards_4apr02.pdf" target="_blank"&gt;Woodward's Independent Financial Advisers&lt;/a&gt;&lt;/td&gt;
  &lt;td&gt;04/04/02&lt;/td&gt;
  &lt;td&gt;Pensions review failings&lt;/td&gt;
  &lt;td&gt;&amp;#160;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;]
  </code></pre>
  
  <p>I would like to export this into CSV whilst keeping the table structure as displayed on the website, is this possible and if so how?</p>
  
  <p>Thanks in advance for the help.</p>