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

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

java - SmsManager sending message more than one -