질문자 :Alex 파일 이름에서 확장자를 추출하는 기능이 있습니까? 예. os.path.splitext 사용( Python 2.X 문서 또는 Python 3.X 문서 참조 ): >>> import os >>> filename, file_extension = os.path.splitext('/path/to/somefile.ext') >>> filename '/path/to/somefile' >>> file_extension '.ext' 대부분의 수동 문자열 분할 시도와 달리 os.path.splitext .c/d 대신 확장자가 없는 /a/bc/d 를 올바르게 처리 .bashrc 를 확장자가 없는 것으로 처리합니다 .bashrc : >>> os.path.splite..