기본 콘텐츠로 건너뛰기

라벨이 os()인 게시물 표시

[matplotlib]quiver()함수

파일 관리

내용 os 모듈 os.path 모듈 sys 모듈 파일 관리 os 모듈 파이썬의 os 모듈을 사용하여 디렉토리(directory)를 조정할 수 있습니다. 함수 내용 getcwd() 현재 인터프리터가 작동되고 있는 디렉토리(Current Working Directory)를 나타냄, 문자열 형식 getcwdb() getcwd()와 동일하지만 bytes 형식으로 반환 chdir() 현재 working directory를 다른 디렉토리로 변경 listdir() working directory의 모든 하위디렉토리와 파일의 목록을 반환 mkdir() 지정된 경로에 새로운 디렉토리를 생성. 경로를 지정하지 않으면 working directory에 생성 rename(이름, 교체할 이름) 디렉토리의 이름을 교체 remove() 파일을 삭제 rmdir() 빈 디렉토리를 제거 import os ​ os #모듈의 경로 반환 <module 'os' from 'C:\home\~\anaconda3\lib\os.py'> #getcwd() current=os.getcwd();current '/home/~/python_programming' type(current) str current2=os.getcwdb(); current2 b'/home/~/\xeb\xac\xb8\xec\x84\x9c/python_programming' type(current2) bytes #chdir() os.chdir("/home/~/문서") os.getcwd() '/home/~/문서' #listdir() os...