📅 2009-Sep-30 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ empty, list, python ⬩ 📚 Archive
aList = []
if not aList: # Check if list is empty
print( "Empty" )
else:
print( "Not empty" )
alist.append( 42 )
if alist: # Check if list is not empty
print( "Not empty" )
else:
print( "Empty" )
# Output:
# Empty
# Not empty