goblin2986 goblin2986 - 4 months ago 11
Python Question

how to check whether list contains only None in python

l=[None,None]


is there a function that checks whether list l contains only None or not?

Answer

If you mean, to check if the list l contains only None,

if all(x is None for x in l):
  ...
Comments