[ Python ] 파이썬 폴더 및 파일 이름 변경 방법 날짜: 4월 02, 2022 공유 링크 만들기 Facebook X Pinterest 이메일 기타 앱 [ Python ] 파이썬 폴더 및 파일 이름 변경 방법1. 라이브러리 불러오기import os2. 이름 변경 함수 os.rename(타겟, 변경)3. 테스트os.rename("/home/heojungwook/Test/변경전폴더", "/home/heojungwook/Test/변경후폴더")os.rename("/home/heojungwook/Test/변경전파일.txt", "/home/heojungwook/Test/변경후파일.txt")4. 응용 방법import os# 경로 설정strFilePath = "/home/heojungwook/Test/"# 경로 내부 검색for n in os.listdir(strFilePath): # 동일 이름 변경 os.rename(strFilePath + n, strFilePath + n.replace("전", "후"))==========[ Python ] Visual Studio Code Python 설치 및 실행[ Python ] 파이썬 하위 디렉토리 및 파일 전체 검색 방법[ Python ] Visual Studio 2017 Python EXE 파일 만들기[ Python ] Visual Studio 2017 C# Python 실행 - IronPython[ Python ] Visual Studio 2017 C# Python 실행 - Pythonnet[ Python ] Python for 반복문 사용 방법[ Python ] Python INI 파일 생성 및 쓰고 읽기[ Python ] Python String 길이 구하기 및 자르기[ Python ] Python While 정복하기[ Python ] 파이썬 pywin32 Beep 소리내기[ Python ] 파이썬 폴더 및 파일 이름 변경 방법 댓글
댓글
댓글 쓰기