5
os.path.dirname (__ file__)이 비어 있음을 반환
.py 파일이 실행되는 현재 디렉토리의 경로를 얻고 싶습니다. 예를 들어 D:\test.py코드가 있는 간단한 파일 : import os print os.getcwd() print os.path.basename(__file__) print os.path.abspath(__file__) print os.path.dirname(__file__) 출력이 다음과 같은 것이 이상합니다. D:\ test.py D:\test.py EMPTY 와에서 동일한 결과를 기대 getcwd()하고 path.dirname()있습니다. 주어진 os.path.abspath = os.path.dirname + os.path.basename이유 os.path.dirname(__file__) 비어있는?
165
python