Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to use python all() function to check a list is empty or not

emptyList = [1]
length = len(emptyList)

if length == 0 and all(emptyList):
    print("This list is empty now.")
else:
    print("This list is not empty.

The values of list:")
    for x in emptyList:
        print(x)
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #python #function #check #list #empty
ADD COMMENT
Topic
Name
5+2 =