On: 'The Python CSV Module and Legacy Data'

Discussion in 'Python' started by Paddy McCarthy, Apr 26, 2004.

  1. 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.
    Paddy McCarthy, Apr 26, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?aW5ldG11Zw==?=
    Replies:
    0
    Views:
    439
    =?Utf-8?B?aW5ldG11Zw==?=
    May 27, 2005
  2. Daniel Ortmann
    Replies:
    4
    Views:
    554
    Skip Montanaro
    Jul 2, 2003
  3. Tintin92
    Replies:
    1
    Views:
    1,665
    Andrew Thompson
    Feb 14, 2007
  4. jliu66
    Replies:
    0
    Views:
    484
    jliu66
    Oct 19, 2007
  5. inetmug
    Replies:
    2
    Views:
    193
    inetmug
    Jun 3, 2005
Loading...

Share This Page