상세 컨텐츠

본문 제목

[Python] 패키지

Python

by TUZA 2022. 6. 4. 16:37

본문

패키지

: 관련 있는 모듈을 하나의 폴더로 구성해놓은 것을 말한다.

 

# 1. import 패키지.모듈

import unit.character

unit.character.test()

# 2. from 패키지 import 모듈

from unit import item
item.test()


# 3. import  패키지 import *
from unit import *

character.test()
item.test()
monster.test()


# 4. import 패키지
import unit

unit.character.test()
unit.monster.test()
unit.item.test()

사진: 위 코드의 파일구성

 

반응형

'Python' 카테고리의 다른 글

[Python] 문자열 다루기  (0) 2022.06.06
[Python] 소수점 관리하기  (0) 2022.06.04
[Python] 모듈  (0) 2022.06.04
[Python] 클래스 변수  (0) 2022.06.04
[Python] 상속  (0) 2022.06.02

관련글 더보기