leora leora - 1 year ago 111
Python Question

Creating a new dict in Python

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?

Answer Source

Call dict with no parameters

new_dict = dict()

or simply write

new_dict = {}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download