any函数
any(x) 判断x对象的所有元素都为空对象,如果都为空、0、false,则返回false,否则返回true
all函数
all(x) 判断x对象的所有元素都不为空对象,如果都不为空、0、False,则返回True,否则返回False
print(any([1,2,3,4,5])) True print(any(['a','b','c','d',''])) True print(any([1,2,3,0,5])) True print(any([0,False,''])) False print(any((1,2,3,4,5))) True print(any(('a','b','c','d',''))) True print(any((1,2,3,0,5))) True print(any((0,False,''))) False print(any([])) False print(any(())) False print(any({})) False print(all([1,2,3,4,5])) True print(all(['a','b','c','d',''])) False print(all([1,2,3,0,5])) False print(all([0,False,''])) False print(all((1,2,3,4,5))) True print(all(('a','b','c','d',''))) False print(all((1,2,3,0,5))) False print(all((0,False,''))) False print(all([])) True print(all(())) True print(all({})) True