if list not empty code example
Example 1: can python tell if a list is empty
>>> if len(a)==0:
print ("list is empty")
else:
print ("list is not empty")
Example 2: check if empty item in list python
if '' in list:
# do stuff
>>> if len(a)==0:
print ("list is empty")
else:
print ("list is not empty")
if '' in list:
# do stuff