scroobius-pip
10/6/2016 - 12:42 PM

List to dictionary

List to dictionary

def list2dict(L, keylist): return { x:y for (x,y) in zip(keylist, L) } 
 or
def list2dict(L,keylist): return {L[x]:keylist[x] for x in range(len(L)) }