CSV: minimalquoting and skipinitialspace,

Martin Bless mb at muenster.de
Wed May 19 15:35:30 EDT 2004


[Skip Montanaro <skip at pobox.com>]

>Can you post a feature request to the Python 
>project on SF?

Ok, I think I can do that. Having thought it over I'd love to see this
logic:

# pseudo code, untested
if dialect.quoteminimal:
    quote_the_field = False
    if dialect.delimiter in field:
        quote_the_field = True
    elif dialect.separator in field:
        quote_the_field = True

    # NEW: do quoting if field starts OR ends with a space or a tab
    elif field[:1] in " \t" or field[-1:] in " \t":
        quote_the_field = True


>Even better would be a patch that implements the idea. ;-)

Too bad, I can't. I had a look at it: the crucial parts are in the
c-code. That's too far for me in the moment ...

MB - Martin Bless



More information about the Python-list mailing list