나는 이렇게 학습한다 575

Tenacity _ 예외가 발생한 함수를 다시 실행하려면?

Tenacity 란? 보통 에러나 예외처리에 의해 런타임이 종료될 때가 있다. Tenacity는 런타임 종료없이 함수를 다시 실행시켜주는 Python 라이브러리이다. 사용법 1. Tenacity 설치 pip install tenacity 2. Tenacity 라이브러리 가져오기 및 함수 작성 import tenacity def throw_error(): print("running...") raise ValueError("Errors make me stronger") if __name__ == "__main__": throw_error() 이대로 스크립트를 실행해보면 우리가 의도한대로 에러가 발생하며 곧바로 스크립트가 종료된다. running... Traceback (most recent call last..

0825. Find the first non-consecutive number

Your task is to find the first element of an array that is not consecutive. By not consecutive we mean not exactly 1 larger than the previous element of the array. E.g. If we have an array [1,2,3,4,6,7,8] then 1 then 2 then 3 then 4 are all consecutive but 6 is not, so that's the first non-consecutive number. If the whole array is consecutive then return null2. The array will always have at leas..