python:all or any
程序员文章站
2022-06-07 10:30:20
...
all和any的而使用:
x = [True, True, False]
if any(x):
print('At least one True')
if all(x):
print('Not one False')
if any(x) and not all(x):
print('at least one True and one False')