logo
Search검색어를 포함하는 게시물들이 최신순으로 표시됩니다.
    Table of Contents
    [Python] 패키지, 모듈 위치 확인, 'Inspect'

    이미지 보기

    [Python] 패키지, 모듈 위치 확인, 'Inspect'

    • 21.07.20 작성

    • 읽는 데 1

    TOC

    패키지, 모듈 위치 확인 'Inspect'

    • 지금까지는 같은 디렉토리나 같은 파이썬 라이브러리에 있는 모듈을 참조하였는데, 이 모듈이나 패키지의 위치를 확인할 수 있는 방법을 알아보자.
    from travel import *
    
    trip_to = thailand.ThailandPackage()
    trip_to.detail()
    
    import inspect
    import random
    
    print(inspect.getfile(random))
    print(inspect.getfile(thailand))
    

    출력값은 다음과 같다.

    # random file의 위치
    
    C:\Users\(내 이름)\AppData\Local\Programs\Python\Python39\lib\random.py
    
    # thailand file의 위치
    
    C:\Intellij\python\나도코딩\기본편(6H)\travel\thailand.py
    

    Reference

    profile

    FE Developer 박승훈

    노력하는 자는 즐기는 자를 이길 수 없다