csv Parser Question - Handling of Double Quotes

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Mar 27 16:53:23 EDT 2008


En Thu, 27 Mar 2008 17:37:33 -0300, Aaron Watters  
<aaron.watters at gmail.com> escribió:

>> "this";"is";"a";"test"
>>
>> Resulting in an output of:
>>
>> ['this', 'is', 'a', 'test']
>>
>> However, if I modify the csv to:
>>
>> "t"h"is";"is";"a";"test"
>>
>> The output changes to:
>>
>> ['th"is"', 'is', 'a', 'test']
>
> I'd be tempted to say that this is a bug,
> except that I think the definition of "csv" is
> informal, so the "bug/feature" distinction
> cannot be exactly defined, unless I'm mistaken.

AFAIK, the csv module tries to mimic Excel behavior as close as possible.  
It has some test cases that look horrible, but that's what Excel does...  
I'd try actually using Excel to see what happens.
Perhaps the behavior could be more configurable, like the codecs are.

-- 
Gabriel Genellina




More information about the Python-list mailing list