728x90
작성일자 : 23.02.06
import os
# 하위 디렉토리는 생성할 수 없음
os.mkdir('./new_folder')
# 디렉토리 생성 1
os.makedirs('./a/b/c', exist_ok=True) # 기존에 해당하는 폴더가 있어도 exception 에러 넘어갈 수 있음 exist_ok = True 하면
# 디렉토리 생성 2
def makedirs(path):
try:
os.makedirs(path)
except OSError:
if not os.path.isdir(path):
raise
path = ~/test/
makedirs(path)
728x90
'Done > C++_Python' 카테고리의 다른 글
[Deep learning] Pytorch 처음부터 KITTI dataset을 이용한 object detection - [0] (0) | 2023.06.09 |
---|---|
[C++] 함수의 전달(값, 참조, 주소) [* , &] (0) | 2023.06.05 |
[OpenCV python]컨투어 찾기 ( cv2.findContours ) (0) | 2023.06.01 |
[Ubuntu CMake] OpenCV 원하는 폴더에 build & Install (0) | 2023.06.01 |
[Ubuntu CMake] VSCode CMake build&debug (C++) (0) | 2023.06.01 |