By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,965 Members | 1,450 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,965 IT Pros & Developers. It's quick & easy.

On: 'The Python CSV Module and Legacy Data'

P: n/a
Hi,
I read http://radio.weblogs.com/0124960/ which has a quoted number in
a csv file being interpreted as a string.
I checked it out with my csv2txt utility
(http://www.paddyx.pwp.blueyonder.co.uk/)
And that does seem to be the case.

Should this action not be thought of as an error?
If the csv module reads a quoted string shouldn't it present it
internally as a string?

Since the csv reader is intelligent, maybe the correct proceedure
would be for it to:
* If it only sniffs out numbers held in strings then change all
strings containing valid numbers to numbers.
* If it initially sniffs out unquoted numbers, or no numbers at all,
or a mixture of quoted and unquoted numbers, then return un-quoted
numbers as numbers and quoted numbers as strings.

Or we could explicitely tell the CSV module what to do with quoted
number strings!

I haven't checked what the csv writer does with a string that could
also represent a number. Will it quote that on output? hmmm...

Cheers, Paddy.
Jul 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.