Python/Python Programming

[Python] 디렉토리 / 파일 유효성 확인

Pydole 2019. 9. 25. 13:48
from os.path import isfile  # 파일 유효성 체크 모듈
from os.path import isdir   # 디렉토리 유효성 체크 모듈

print(isfile(r'D:\test.txt')) # 참 : True , 없으면 : False
print(isdir(r'D:\test')) # 참 : True , 없으면 : False
--------------------------------------------------------------
True
True