Python 현재 디렉토리명 얻기

1 개요[ | ]

Python 현재 디렉토리명 얻기
파이썬 현재 디렉토리명 얻기
Python
Copy
import os
dirname = os.getcwd().split('/')[-1]
print( dirname )
Python
Copy
import os
import re
dirname = re.search('[^/]+$', os.getcwd()).group(0)
print( dirname )

2 같이 보기[ | ]