Reputation: 167
I want to create a dictionary from several lists. For example:
list1=[11, 12, 13, 14]
list2=[a, b, c, d]
list3=[e, f, g, h]
and the result should be:
dict={11: [a,e], 12:[b,f], 13:[c,g], 14:[d,h]}
Thanks
Upvotes: 1
Views: 69
Reputation: 6206
Like so:
obj = {}
for x,y,z in zip(list1,list2,list3):
obj[x] = [y,z]
Upvotes: 2