help with simple regular expression grouping with re

Laurence Tratt tratt at dcs.kcl.ac.uk
Tue May 11 14:21:24 EDT 1999


In message <3733B676.1A539CA9 at horvath.com>
          Bob Horvath <bob at horvath.com> wrote:

> The input that I am parsing is a typical "mail merge" file, containing
> comma separated fields that are surrounded by double quotes.  A typical
> line is:

Although this isn't exactly the answer you were looking for, a CSV library I
coded up last year is available from:

  http://eh.org/~laurie/comp/python/csv/

It's at version 0.14.

Of course, as there is no agreed CSV standard that I know of, it's possible
that it doesn't cover every conceivable case (new lines in fields is the one
that springs to mind), but it should cope with most CSV files as is, and
even puts them in a reasonably nice list/dictionary format for you to fiddle
in Python.


Laurie




More information about the Python-list mailing list