I want to create a dictionary out of a given list, in just one line. The keys of the dictionary will be indices, and values will be the elements of the list. Someth
Simply use list comprehension.
a = [51,27,13,56] b = dict( [ (i,a[i]) for i in range(len(a)) ] ) print b