Python Ordered Dictionary to regular Dictionary -


i have like

[('first', 1), ('second', 2), ('third', 3)] 

and want built in function make like

{'first': 1, 'second': 2, 'third': 3} 

is aware of built-in python function provides instead of having loop handle it?

needs work python >= 2.6

dict can take list of tuples , convert them key-value pairs.

>>> lst = [('first', 1), ('second', 2), ('third', 3)] >>> dict(lst) {'second': 2, 'third': 3, 'first': 1} 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -