요약

  • 현재 경로 확인: os.getcwd()
  • 경로 변경: os.chdir('new_path')
  • 경로 내 목록: os.listdir('path')
  • 신규 폴더 생성: os.makedirs('new_folder_name')

1. 경로 설정

import os
 
os.getcwd()          # 현재 경로 확인
os.chdir('./new_path')  # 경로 변경

2. 목록 확인 및 폴더 생성

os.listdir()  # 현재 경로 내 파일 목록
 
if not os.path.exists('folder_name'):
    os.makedirs('folder_name')

3. 제거

os.rmdir('folder_name')

참고사이트