string to dictionary
les ander
les_ander at yahoo.com
Fri Mar 1 18:22:21 EST 2002
Hi,
i have a list of strings like this:
aList=[ 'a_1 b_1', 'a_2 b_2', 'a_3 b_3',...]
i want to convert this to a dictionary with a_i -> b_i without
using loops (it is trivial to do it with loops)
i tried this
dict={}
map(lambda x,d=dict: c=string.split(x), d[c[0]]=c[1], aList)
but it complains that "keyword can't be an expression"
can someone please help me get this right?
thanks
les
More information about the Python-list
mailing list