로딩
티스토리 데이터 처리 중입니다.

[Python] builtin all() 함수

 [Python] builtin all() 함수

정의 def all(*args, **kwargs): # real signature unknown """ Return True if bool(x) is True for all values x in the iterable. If the iterable is empty, return True. """ pass all() 함수는 iterable 안의 값이 모두 참이거나 empty 라면 return True.

그렇지 않다면 return False 를 한다. 실행결과 sample = [ [], [0], ['0'], [1], ['1'], [0, 1, 2], [1, 2, 3], [-0], [-1], [True], [False], ] for s in sample: print(s, '=>', all(s)) """ [] =.....