I have multiple variables in my python script.
I would like to check if any variable is None out of my variables.
Following are my variables:
a = 'a' b = 'b' c = None
Python has a built in method called “all” which return True if all elements of the iterable are true (or if the iterable is empty).
So here I am using all method to check if any declared variables are None. I am using following code:
print all([a, b, c])
print all([a, b])
If we observe above two print statements with all method, first statement output is False since variable c is None and second statement output is True since variables a and b are not None.