all(iterable)
如果所有可迭代元素为true则返回true。如果可迭代元素为空,亦返回true。等价于
Return True if all elements of the iterable are true (or if the iterable is empty). Equivalent to:
def all(iterable):
for element in iterable:
if not element:
return False
return True
any(iterable)
如果任一可迭代元素为true则返回true。如果可迭代元素为空,返回false。等价于
Return True if any element of the iterable is true. If the iterable is empty, return False. Equivalent to:
def any(iterable):
for element in iterable:
if element:
return True
return False