Fix Python – Creating a new dictionary in Python

Question

Asked By – leora

I want to build a dictionary in Python. However, all the examples that I see are instantiating a dictionary from a list, etc . ..

How do I create a new empty dictionary in Python?

Now we will see solution for issue: Creating a new dictionary in Python


Answer

Call dict with no parameters

new_dict = dict()

or simply write

new_dict = {}

This question is answered By – Jan Vorcak

This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0