파이썬[Python]: keyword - assert 키워드
내장함수 - assert 키워드(keyword)
/// 설명
디버깅의 편리성을 위해 사용합니다.(표현(expression)이 False 일 경우 오류를 발생시킵니다.)
※ 형식
assert
reference
https://docs.python.org/3/reference/simple_stmts.html#grammar-token-python-grammar-assert_stmt
※ 형식
assert
reference
https://docs.python.org/3/reference/simple_stmts.html#grammar-token-python-grammar-assert_stmt
/// 예제
1 2 3 4 5 6 7 8 9 10 11 12 | a = True assert a if a: print('Not Error') else: print('means Error') b = 1 assert b >= 0 # assert b < 0, 'b >= 0' # AssertionError | cs |
* 실행환경: Microsoft Windows 10 Homes
* 인터프리터: 파이썬(Python 3.9)
– 당신을 응원합니다. –
댓글
댓글 쓰기