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
'Python > Python Programming' 카테고리의 다른 글
[Python] iglob메소드와 재귀를 이용한 모든 하위 디렉토리 특정 확장자 파일 검색 (0) | 2019.10.06 |
---|---|
[Python] 리스트 append 메소드와 insert 메소드 (0) | 2019.10.02 |
[Python] 리스트의 값을 여러 변수에 다중할당 (0) | 2019.10.02 |
[Python] itertools을 이용한 곱집합 만들기 (0) | 2019.09.27 |
[Python] 정규식을 이용하여 문자열에서 숫자와 문자를 제외한 나머지 일괄 변경 시키기 (0) | 2019.09.23 |
[Python] isinstance 내장함수 - 리스트나 튜플에서 타입별로 요소 추출하기 (0) | 2019.09.11 |
[Python] max, min, sum 내장함수 (0) | 2019.08.24 |
[Python] Send Slack Massages and upload file (0) | 2019.08.02 |