My list contains the following elements:
>>> s = "foo a=b c=d e=f"
>>> s.split()
['set', 'a=b', 'c=d', 'e=f']
>>> splitted = s.split()
>>> splitted[1:]
['a=b', 'c=d', 'e=f']
Now I want to use map to get the following result:
[{'a': 'b'}, {'c': 'd'}, {'e': 'f'}]
I tried the following, but this gives me an IndexError:
>>> map(lambda x : dict((a[0], a[1]) for a in x.split('=')) , splitted[1:])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 1, in <lambda>
File "<stdin>", line 1, in <genexpr>
IndexError: string index out of range