■ import문으로 모듈을 사용하는 방법을 보여준다.
▶ module1.py
1 2 3 4 |
def GetString(): return "모듈 1" |
▶ folder1/module2.py
1 2 3 4 |
def GetString(): return "모듈 2" |
▶ folder2/module3.py
1 2 3 4 |
def GetString(): return "모듈 3" |
▶ main.py
1 2 3 4 5 6 7 8 9 |
import module1 import folder1.module2 as module2 import folder2.module3 as module3 print(module1.GetString()) print(module2.GetString()) print(module3.GetString()) |