본문 바로가기
파이썬

파이썬 Path to a file without basename

by º기록 2021. 2. 12.
반응형

파일 basename없이 파일의 경로를 어떻게 얻을 수 있습니까?

/a/path/to/my/file.txt -> / a / path / to / my / 와 같은 것

성공하지 않고 .split () 시도

 

해결 방법

 

os.path.dirname (filename) 을 사용하세요.

 

참조 페이지 https://stackoverflow.com/questions/11757520

 

 

반응형

댓글