Python - sys , modules, path

Jade J·2021년 2월 22일
0

Python Learning

목록 보기
2/3

sys.modules 와 sys.path의 차이점을 서술해 주세요.

sys 도 import 해야하는 모듈입니다. 파이썬은 sys 모듈의 위치를 어떻게 찾을 수 있을까요?

Absolute path와 relative path의 차이점을 서술해 주세요.

calculator 패키지 만들기

참고 자료: Python Tutorial for Beginners 9: Import Modules and Exploring The Standard Library

package, modules

파이썬은 패키지와 모듈로 효율적으로 관리할 수 있다.

path

sys.path

우리가 module 을 import 할때 경로를 찾는다. 그리고 그 경로는 sys.path 라는 list 에 저장되어있다.

import sys 

print(sys.path)
['현재 디렉토리' ...]
#디렉토리 리스트 형태로 나타난다.

absolute and relative path

profile
개발의 길을 걷자

0개의 댓글