Let’s say I have a list a
in Python whose entries conveniently map to a dictionary. Each even element represents the key to the dictionary, and the following odd element is the value
for example,
a = ['hello','world','1','2']
and I’d like to convert it to a dictionary b
, where
b['hello'] = 'world'
b['1'] = '2'
What is the syntactically cleanest way to accomplish this?