728x90
jupyter notebook의 module load
- jupyter lab이나 notebook을 사용할 때 가장 불편했던 점이 어느 정도 프로젝트가 진행 된 후 자주 사용되는 함수들을 모듈화 시켜
.py
파일로 저장했을 때, py 파일을 수정했을 때 kernel을 재시작해야 반영이 되는 점이었다. - 노트북에 두 줄의 코드를 입력하는 것으로 커널을 매번 재시작하지 않고 모듈의 수정사항을 반영할 수 있다.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%load_ext autoreload <<< this line and | |
%autoreload 2 <<< this line | |
import my_module | |
import my_module2 | |
""" some code """ |
Reference
[1] ipython autoreload document
'프로그래밍 언어 > python' 카테고리의 다른 글
numpy array broadcasting 0 | 2022.07.26 |
---|---|
short-circuit evaluation 0 | 2022.07.26 |
*args와 **kwargs 활용하기 0 | 2022.07.26 |
matplotlib 테마 설정하기 0 | 2022.07.26 |
lambda 함수 0 | 2022.07.26 |