[Csv] Access Products sample

Dave Cole djc at object-craft.com.au
Sat Feb 1 06:26:11 CET 2003


>>>>> "Cliff" == Cliff Wells <LogiplexSoftware at earthlink.net> writes:

Cliff> On Thu, 2003-01-30 at 18:00, Dave Cole wrote:
>> >>>>> "Skip" == Skip Montanaro <skip at pobox.com> writes:
>> 
>> >>> The currency column in the table is actually written out with
>> >>> formatting ($5.66 instead of just 5.66). Note that when Excel
>> >>> exports this column it has a trailing space for some reason >>>
>> (,$5.66 ,).
>> 
Cliff> So we've actually found an application that puts an extraneous
Cliff> space around the data, and it's our primary target.  Figures.
>>
Skip> So we just discovered we need an "access" dialect. ;-)
>>  Not really.  Python has no concept of currency types (last time I
>> looked).  The '$5.66 ' thing is an artifact of converting currency
>> to string, not float to string.

Cliff> I'm not sure what you mean.  A trailing space is a trailing
Cliff> space, regardless of data type.  In this case, it isn't too
Cliff> important as the data isn't quoted (we can just consider the
Cliff> space part of the data), but it shows that extraneous spaces
Cliff> might not be outside the scope of our problem.

In my typically clumsy way I was trying to say that Excel has more
type information available to it regarding the data being exported.
The fact that the data has been formatted as currency tells Excel that
it is not just a float, it is a money.  Python does not have a money
type.

It seems that Excel then exports the money in a way which allows it to
restore the formatting/type on import.  Mind you I have not tried
export/import on Excel, I am just guessing that the type is restored
on import.

- Dave

-- 
http://www.object-craft.com.au



More information about the Csv mailing list