Novice Question: two lists -> dictionary

Alex alex at somewhere.round.here
Thu Apr 15 18:52:24 EDT 1999


Here's a way using functional programming that also seems to work.  It's
rather horrible, though.

Dict = {}
map (operator.setitem, len (ListA) * [Dict], ListA, \
     map (copy.copy, len (ListA) * [[]]))
map (apply, map (getattr, map (operator.getitem, \
                               len (ListA) * [Dict], ListA), \
                 len (ListA) * ['append']), \
     map (tuple, ListB))
     
print Dict

Alex.




More information about the Python-list mailing list