keys = ['a', 'b','c','d'] vals = [[1, 2, 3, 5], [6, 7, 8, 10], [11, 12, 13, 15]] dict(zip(keys, zip(*vals))) {'a': (1, 6, 11), 'c': (3, 8, 13), 'b': (2, 7, 12), 'd': (5, 10, 15)}
Itβs useful to see what happens when you zip(*) an object, this is a pretty useful trick:
zip(*vals) [(1, 6, 11), (2, 7, 12), (3, 8, 13), (5, 10, 15)]
It looks (and you will see another answer), like transposition! There is a "gotcha". If one of the lists is shorter than the others, zip(*) will stop prematurely:
vals = [[1, 2, 3, 5], [6, 7, 8, 10], [11, 12, 13]] zip(*vals) [(1, 6, 11), (2, 7, 12), (3, 8, 13)]