There’s no mention of numpy in the question. If by array you mean list, then if you treat a list as a boolean it will yield True if it has items and False if it’s empty.
l = []
if l:
print "list has items"
if not l:
print "list is empty"
There’s no mention of numpy in the question. If by array you mean list, then if you treat a list as a boolean it will yield True if it has items and False if it’s empty.
l = []
if l:
print "list has items"
if not l:
print "list is empty"