python dict to tuple list code example
Example 1: python dict from list of tuples
>>> my_list = [('a', 1), ('b', 2)]
>>> dict(my_list)
{'a': 1, 'b': 2}
Example 2: tuple to dict
t = (1, 2)
d = dict([t])
>>> my_list = [('a', 1), ('b', 2)]
>>> dict(my_list)
{'a': 1, 'b': 2}
t = (1, 2)
d = dict([t])