Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

check dictionary is empty or not in python

test_dict = {}

if not test_dict:
    print "Dict is Empty"


if not bool(test_dict):
    print "Dict is Empty"


if len(test_dict) == 0:
    print "Dict is Empty"
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #dictionary #empty #python
ADD COMMENT
Topic
Name
3+1 =