mapping functions and lambda

Suresh Jeevanandam jm.suresh at gmail.com
Thu Feb 16 00:02:29 EST 2006


Given a string
s = 'a=1,b=2'

I want to create a dictionary {'a': '1', 'b': '2'}

I did,

dict(map(lambda k: k.split('='), s.split(',')))

Is it possible to get rid of the lambda here, without having to define 
another function just for this.

Is this the easiest/straight-forward way to do this?

regards,
Suresh



More information about the Python-list mailing list