Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python check if object is empty

dict1 = {}

if dict1:
    print("dict1 Not Empty")
else:
    print("dict1 is Empty")

if bool(dict1):
    print("dict1 Not Empty")
else:
    print("dict1 is Empty")
Source by discuss.codecademy.com #
 
PREVIOUS NEXT
Tagged: #python #check #object #empty
ADD COMMENT
Topic
Name
6+5 =