반응형 Raise1 [Python] 예외처리 try, except, finally and raise | LIM 📌 python의 예외처리 1. try & except 우리가 대표적으로 예외처리를 하는 방법이다. def exception_test(self): try: abc = 321 abc.lower() except Exception as e: print("err message:", e) err message: 'int' object has no attribute 'lower' 2. try & except & finally finally 까지 추가하면 에러 발생과 관계 없이 항상 실행되는 코드를 추가로 구성할 수 있다. def exception_test_with_finally(self): try: abc = 321 abc.lower() except Exception as e: print("err message:".. 2022. 6. 24. 이전 1 다음 반응형