How to check if array is not empty? [duplicate]

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"

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)