Python Create Dictionary from List of Tuples

To create a dictionary from list of tuples in Python, where each tuple is of the form (key, value), pass the list of tuples as argument to dict() builtin function.

dictlist of tuples object

In this example, we will give a list for tuples as argument to dict() function.

Python Program

iterable = [('m', 4), ('p', 8)]
myDictionary = dict(iterable)
print(myDictionary)

Output

{'m': 4, 'p': 8}

Conclusion

In this Python Tutorial, we learned how to create a dictionary from a list of tuples using Python dict() builtin function.