468

2 分钟

#any

说明:判断可迭代对象内容是否存在真值。

def any(iterable): ''' 判断可迭代对象内容是否存在真值 :param iterable: 一个可迭代对象 :return: 如果 iterable 中存在真值则返回 True,否则返回 False;如果 iterable 是空的,返回 False '''

示例:

print(any([])) # 空的可迭代对象返回 False print(any(range(10))) # 0...9 print(any([0 for _ in range(0)])) # 0...0

>>> Establishing WebAssembly Runtime.

>>> Standby.

Powered by Shift.

创建于 2025/5/9

更新于 2025/5/11