Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

# to check if the list is empty use len(l) or not

# to check if the list is empty use len(l) or not 
l = []

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

#or

if not l:
  print("list is empty") 
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #check #list #empty
ADD COMMENT
Topic
Name
7+8 =