Troubles with CSV file

Fuzzyman michael at foord.net
Mon May 17 11:20:39 EDT 2004


[snip...]

> I replace all "" to """ as suggested and all works fine now. This is not the
> ideal solution (sometimes csv file have a data like
> <some-data>, 123, "", 345, <some-data>
> 
> ... which supposed to be a blank string (not shure). But it is irrelevant
> for me now and *replacing* approach is pretty satisfactory.
> 
> Thanks again for your help.
> 
> BTW
> http://www.voidspace.org.uk/atlantibots/pythonutils.html  is unreachable
> ( "The page cannot be displayed" error )
> 
>     Vladimir Ignatov

I think I previously stated that it was the unquote function in my csv
module.
In actual fact it is the linehandle function that handles the
unquoting.
If you have trouble amending it to cope with double quotes then let me
know - I can hack together an amendment for you........ ( email me at
mike AT pcblokes DOT com )

I think you will have to make a compromise though - in either case you
make one possibility impossible - if you allow double quotes, except
for

"",
Which you just treat as an empty single quote.... then any double
quoted lines beginning with a comma become impossible.
"", all this is upposed to be between double quotes ""
(This is why the rest of the world doesn't use double quotes and
single quotes in the same files !)

My listparser module has the unquote function I was talking about.
(and may also be relevant).

Regards,

Fuzzy



More information about the Python-list mailing list