rfind()
string = "Hello there"
string.rfind('찾고자하는 문자', 처음위치, 마지막 위치)
찾는 문자열 중에 가장 끝에 있는 위치를 반환한다
os.listdir(path) # 파일목록전달
os.chdir(path) # 작업하고 있는 디렉토리 변경
os.getcwd() # 현재 프로세스의 작업 디렉토리 얻기
os.path.abspath(filename) # 파일의 상대 경로를 절대 경로로 바꾸는 함수
os.path.exists(filename) # 주어진 경로의 파일이 있는지 확인하는 함수
os.curdir() # 현재 디렉토리 얻기
os.pardir() # 부모 디렉토리 얻기
os.sep() # 디렉토리 분리 문자 얻기
os.path.basename(filename) # 파일명만 추출
os.path.dirname(filename) # 디렉토리 경로 추출
os.path.split(filename) # 경로와 파일명을 분리
os.path.join(path,path) # \\패턴으로 경로를 만들어줌
os.path.splitdrive(filename) # 드라이브명과 나머지 분리 (MS Windows의 경우)
os.path.splitext(filename) # 확장자와 나머지 분리
shutil.copy(path, newPath) # 파일 복사
shutil.copy2(path, newPath) # 파일 복사 (설정값도 함께 복사)
shutil.move(path, newPath) # 파일 이동줌
출처: https://man-about-town.tistory.com/44 [YongWook's Notes]
path 관련 자료
https://devanix.tistory.com/298
댓글