how can i change the text delimiter

sonald sonaldgr8 at gmail.com
Wed Aug 30 07:55:27 EDT 2006


Hi ,
thanks for the reply...

fast csv is the the csv module for Python...
and actually the string cannot be modified because
it is received from a third party and we are not supposed to modify the
data in any way..


for details on the fast CSV module please visit

www.object-craft.com.au/projects/csv/ or

import fastcsv
csv = fastcsv.parser(strict = 1,field_sep = ',') // part of
configuration

and somewhere in the code... we are using

data = csv.parse(line)

all i mean to say is, csv.reader  is nowhere in the code
and somehow we got to modify the existing code.

looking forward to ur kind reply ...




Fredrik Lundh wrote:
> "sonald" wrote:
>
> > Thanks for a quick response...
> > E.g record is: "askin"em"
>
> that's usually stored as "askin""em" in a CSV file, and the csv module
> has no problem handling that:
>
>     >>> import csv, StringIO
>     >>> source = StringIO.StringIO('"askin""em"\n')
>     >>> list(csv.reader(source))
>     [['askin"em']]
>
> to use another quote character, use the quotechar option to the reader
> function:
>
> >>> source = StringIO.StringIO('|askin"em|\n')
> >>> list(csv.reader(source, quotechar='|'))
> [['askin"em']]
>
> > Also please note that the string cannot be modified at all.
>
> not even by the Python program that reads the data?  sounds scary.
>
> what's fastcsv, btw?  the only thing google finds with that name is a
> Ruby library...
> 
> </F>




More information about the Python-list mailing list