PEP 305 - CSV File API

Carlos Ribeiro cribeiro at mail.inet.com.br
Mon Feb 3 21:18:03 EST 2003


On Monday 03 February 2003 08:33 pm, John Machin wrote:
> Anybody who wants "00012345", "00098765" interpreted as
> int("00012345"), int("00098765") should stick with Excel. No guessing,
> please!

If the CSV record is written as:

"00012345","00098765"

... then you're right - any decent CSV library should read that as two 
strings. BUT...

00012345,00098765

... should be read as two ints - there are no quotes, so the CSV reader 
*should* assume that these are two numbers, not strings.

As for the automatic detection, I'm also against it. That's why some support 
for column names and types when reading/writing tabular data should be part 
of the spec.

p.s. I'm using Excel and I'm not ashamed of it. Should I ? :-)


Carlos Ribeiro





More information about the Python-list mailing list