How to create an empty dictionary in Python?

PythonServer Side ProgrammingProgramming

You can create empty dictionary object by giving no elements in curly brackets in assignment statement. Empty dictionary object is also created by dict() built-in function without any arguments

>>> L1
[]
>>> d1 = {}
>>> d1
{}
>>> d1 = dict()
>>> d1
{}
raja
Updated on 30-Jul-2019 22:30:21

Advertisements