Regular expression for "key = value" pairs

Mark Wooding mdw at distorted.org.uk
Wed Dec 22 11:55:27 EST 2010


André <andre.roberge at gmail.com> writes:

> How about the following:
>
> >>> s = 'a=b,c=d'
> >>> t = []
> >>> for u in s.split(','):
> ...     t.extend(u.split('='))

s = 'a = b = c, d = e'
        => ['a ', ' b ', ' c', ' d ', ' e']

Ugh.

-- [mdw]



More information about the Python-list mailing list