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