How to check if a list is empty in Python?
if not myList:
print "Nothing here"
I like Zarembisty's answer. Although, if you want to be more explicit, you can always do:
if len(my_list) == 0:
print "my_list is empty"
Empty lists evaluate to False in boolean contexts (such as if some_list:
).