데이터 분석/[Python] 기초
[Python] 디렉토리에 폴더 생성
INCHELIN
2020. 9. 2. 16:21
728x90
- 디렉토리에 해당 파일 존재 유무 확인
import os
os.path.isfile("C:/User/파일.txt")
# True or False 반환
- 디렉토리에 해당 파일이 존재 하지 않으면 파일 생성
if not os.path.isdir("C:/User/파일.txt"):
os.mkdir("C:/User/파일.txt")
728x90