check empty list in if statement python 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