I have this list :
a = [[], [], []]
and that one :
b = [[], [2], []]
I would like to check if a and b are empty. I mean for me a is empty and b is not. How can I do that ?
Thank you very much !
CodePudding user response:
Using any
:
>>> any([[], [], []])
False
>>> any([[], [2], []])
True
CodePudding user response:
You could check for "empty" using not any
>>> not any(a)
True
>>> not any(b)
False