CSV with comments

skip at pobox.com skip at pobox.com
Tue Jul 18 22:03:20 EDT 2006


Whoops, missed the second part.

    John> Is there any reason to prefer this approach to Daniel's, apart
    John> from being stuck with an older (pre-yield) version of Python?

No, it's just what I came up with off the top of my head.

    John> A file given to csv.reader is supposed to be opened with "rb" so
    John> that newlines embedded in data fields can be handled properly, and
    John> also (according to a post by Andrew MacNamara (IIRC)) for DIY
    John> emulation of "rU". It is not apparent how well this all hangs
    John> together when a filter is interposed, nor whether there are any
    John> special rules about what the filter must/mustn't do. Perhaps a few
    John> lines for the docs?

Yeah, I was also aware of that.  In the common case though it's not too big
a deal.  If the OP is editing a CSV file manually it probably isn't too
complex (no newlines inside fields, for example).

Skip




More information about the Python-list mailing list