Tim Chase <python.l...@tim.thechases.com> wrote:
>    r = re.compile(r"""
>      (\w+)
>      \s*=\s*(
>      "(?:[^"]*)"
>      |
>      [^,]+
>      )
>      """, re.VERBOSE)
>    results = [
>      (m.group(1), m.group(2).strip('"'))
>      for m in r.finditer(s)
>      ]
> 
> Things like internal quoting ('b="123\"456", c="123""456"') would 
> require a slightly smarter parser.

Thank you thank you.  I owe you a dinner if we are ever in the
same town (are you at Pycon?).

I'm not going to worry about the internal quotes unless it shows up in
the real data.  I'm pretty sure it's now allowed by the spec.

--
R. David Murray             http://www.bitdance.com

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to