Merging two lists as a dictionary

Alex alex at somewhere.round.here
Wed Jul 21 10:37:43 EDT 1999


Would 

import operator
destination={}
assert len(list_of_keys)==len(list_of_values)
map(operator.setitem,len(list_of_keys)*[destination],list_of_keys,
    list_of_values)

do the trick?

Maybe the "for" loop way is faster, though.

Alex.




More information about the Python-list mailing list