parse a csv file into a text file

Tim Chase python.list at tim.thechases.com
Wed Feb 5 23:09:52 EST 2014


On 2014-02-05 19:59, Asaf Las wrote:
> On Thursday, February 6, 2014 2:46:04 AM UTC+2, Tim Chase wrote:
> > On 2014-02-05 16:10, Zhen Zhang wrote:
> > Asaf recommended using string methods to split the file.  Keep
> > doing what you're doing (using the csv module), as it attends to
> > a lot of edge-cases that will trip you up otherwise.  I learned
> > this the hard way several years into my Python career. :-)  
> 
> i did not recommend anything :-) 

From your code,

  list_t = str_t.split(',')

It might have been a short-hand for obtaining the results of a CSV
row, but it might be better written something like

  list_t = csv.reader([str_t])

-tkc





More information about the Python-list mailing list