小编use*_*131的帖子

Python: condition to check that none of list's element is an empty list

I have a list of listA; each element of A is a list. I want a condition (to use for a if statement) that return True if all the element of A are non empty and False otherwise. How can I express this condition?

Example 1

A = [[], [5]]
if (condition):
    print("no empty list as elements of A")
else:
    print("at least an empty list inside A")
Run Code Online (Sandbox Code Playgroud)
>>> at least an empty list inside A
Run Code Online (Sandbox Code Playgroud)

Example 2

>>> …
Run Code Online (Sandbox Code Playgroud)

python boolean-logic if-statement list boolean-expression

0
推荐指数
1
解决办法
797
查看次数