Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

How to check if a list is empty in python

l = []
if len(l) == 0: 
    print("the list is empty")

l = []
if l:
  print("the list is not empty")

else: 
  print("the list is empty")


Source by www.howtouselinux.com #
 
PREVIOUS NEXT
Tagged: #How #check #list #empty #python
ADD COMMENT
Topic
Name
4+4 =