Re: mapping functions and lambda

2006-02-15 Thread Steve Holden
Suresh Jeevanandam wrote: > I got it: > dict([k.split('=') for k in s.split(',')]) > > Suresh Jeevanandam wrote: > >>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 r

Re: mapping functions and lambda

2006-02-15 Thread Suresh Jeevanandam
I got it: dict([k.split('=') for k in s.split(',')]) regards, Suresh Suresh Jeevanandam wrote: > 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

mapping functions and lambda

2006-02-15 Thread Suresh Jeevanandam
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? r