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
Published on 08-Feb-2018 19:15:34
Advertisements