<br><font size=2 face="sans-serif">For example the line 1 in the csv file
is:</font>
<br>
<br><font size=2 face="sans-serif">Barney Gumble, Breakfast, Duffbeer,
1, I could?ve gone to Harvard</font>
<br>
<br><font size=2 face="sans-serif">and I want to be able to clean it and
turn it into:</font>
<br>
<br><font size=2 face="sans-serif">Barney Gumble had for beakfast 1 Duffbeer
while thinking &quot;I coul?ve gone to Harvard&quot;</font>
<br>
<br><font size=2 face="sans-serif">so basically using in this line the
column0 + &quot;had for &quot; + column 1 + column3 + column2 + &quot;while
thinking&quot;+column4</font>
<br>
<br><font size=2 face="sans-serif">and I want to be able to do this for
every line, except for line0.</font>
<br>
<br><font size=2 face="sans-serif">My end game is, after I'm able to do
this, I want to write an Html using python that shows those cleand lines</font>
<br>
<br><font size=2 face="sans-serif">Thanks for your help</font>
<br>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40% rowspan=2><font size=1 face="sans-serif"><b>l.leichtnam@gmail.com</b>
</font>
<p><font size=1 face="sans-serif">03/24/2011 11:39 AM</font>
<table border>
<tr valign=top>
<td bgcolor=white>
<div align=center><font size=1 face="sans-serif">Please respond to<br>
l.leichtnam@gmail.com</font></div></table>
<br>
<td width=59%>
<tr valign=top>
<td>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td><font size=1 face="sans-serif">Louis LEICHTNAM/us/socgen@socgen</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td><font size=1 face="sans-serif">Fw: [Tutor] Fw: Fw: Parsing data from
a csv file [NC]</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=3>Ok, I think what you are trying is to get all data in
a string list:<br>
<br>
import urllib, csv<br>
url=r&quot;</font><a href=http://www.cs.columbia.edu/~joshua/teaching/cs3101/simpsons_diet.csv><font size=3 color=blue><u>http://www.cs.columbia.edu/~joshua/teaching/cs3101/simpsons_diet.csv</u></font></a><font size=3>&quot;<br>
simpsons=urllib.urlopen(url)<br>
reader=csv.reader(simpsons,delimiter=',',quotechar='&quot;')<br>
<br>
list_string = []<br>
<br>
for char,meal,ate,qty,com in reader:<br>
&nbsp;&nbsp; if char != 'Character':<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; list_string.append(&quot;%s %s %s %s %s&quot;
% (char, meal, ate, qty, com))<br>
<br>
print list_string<br>
<br>
Doing something like this you can format all strings as you want and keep
them into a list<br>
</font>
<br><font size=3>2011/3/24 &lt;</font><a href=mailto:l.leichtnam@gmail.com><font size=3 color=blue><u>l.leichtnam@gmail.com</u></font></a><font size=3>&gt;</font>
<br><font size=3>Thanks, what I'm trying to do is extract the data from
the csv file, clean it to make each line into a sentence.<br>
<br>
But for this I think I need to use a dictionary for each and enter the
words of each columns in one no?</font>
<br><font size=3>Sent from my BlackBerry® on the MetroPCS Network<br>
</font>
<br><font size=3>-----Original Message-----<br>
From: Rafael Durán Castañeda<br>
&nbsp; &nbsp; &nbsp; &nbsp;&lt;</font><a href=mailto:rafadurancastaneda@gmail.com><font size=3 color=blue><u>rafadurancastaneda@gmail.com</u></font></a><font size=3>&gt;<br>
Sender: tutor-bounces+l.leichtnam=</font><a href=http://gmail.com/ target=_blank><font size=3 color=blue><u>gmail.com</u></font></a><font size=3>@</font><a href=http://python.org/ target=_blank><font size=3 color=blue><u>python.org</u></font></a><font size=3><br>
Date: Thu, 24 Mar 2011 15:51:34<br>
To: &lt;</font><a href=mailto:tutor@python.org><font size=3 color=blue><u>tutor@python.org</u></font></a><font size=3>&gt;<br>
Subject: Re: [Tutor] Fw: Fw: Parsing data from a csv file [NC]<br>
<br>
_______________________________________________<br>
Tutor maillist &nbsp;- &nbsp;</font><a href=mailto:Tutor@python.org><font size=3 color=blue><u>Tutor@python.org</u></font></a><font size=3><br>
To unsubscribe or change subscription options:</font><font size=3 color=blue><u><br>
</u></font><a href=http://mail.python.org/mailman/listinfo/tutor target=_blank><font size=3 color=blue><u>http://mail.python.org/mailman/listinfo/tutor</u></font></a><font size=3><br>
</font>
<br>
<br><pre>
*************************************************************************
This message and any attachments (the "message") are confidential, intended 
solely for the addressee(s), and may contain legally privileged information.  
Any unauthorised use or dissemination is prohibited.  E-mails are susceptible 
to alteration.  Neither SOCIETE GENERALE nor any of its subsidiaries or 
affiliates shall be liable for the message if altered, changed or falsified.
*************************************************************************
</pre>