all function ensures all elements are true in python
Test if all elements of the iterable are true
all
function
returns True if all elements of the iterable are true.
# Equivalent to://w w w . ja va 2s. c o m
# def all(iterable):
# for element in iterable:
# if not element:
# return False
# return True
print all(['A', '', 'B'])
The code above generates the following result.