Python/기초 강의

모듈

개발게발 2022. 8. 1. 18:26

모듈 사용하는 두가지 방법

 

모듈에 print가 있을 경우

  ㄱ. 모듈의 print가 실행됨

 

  ㄴ. if __name__ == "__main__":

  hello.py에서 실행 시 출력X

  mod1.py에서 실행 시 출력O

 

모듈이 다른경로에 있을 경우

 

출처 : https://www.youtube.com/watch?v=YrPu4hEs58s&list=PLU9-uwewPMe2AX9o9hFgv-nRvOcBdzvP5&index=8&t=1328s