파이썬 내장 모듈 활용 가이드
동적 모듈 로딩
문자열로 표현된 모듈 이름을 동적으로 불러오는 방법은 다음과 같습니다:
import importlib
# __import__ 함수 사용 (권장하지 않음)
module = __import__('math')
# importlib.import_module를 통한 안전한 동적 로딩
module = importlib.import_module('collections.abc')
print(module) # <module 'collections.abc' from '...>
모듈 임포 ...
7월 26일 23:02에 게시됨