Python 파일 이름 변경.
os.rename('원래파일', '변경할 파일')
-> 파일 경로와 파일명 지정 후, 변경할 파일 경로 및 파일이름 확장자
ex) os.rename('path/파일명.확장자', 'path/변경할파일명.확장자')
import os
# 원본 데이터셋 폴더 접근.
input_path_1 = r'E:\deep_learning\handwrittenmathsymbols\data\extracted_images\+'
file_list_input_1 = os.listdir(input_path_1)
# 파일_네임_번호
idx = 0
# 원본 파일 순회하며 -> 파일 리네임.
for i in file_list_input_1:
idx += 1
os.rename(r'E:\deep_learning\handwrittenmathsymbols\data\extracted_images\+\{0}'.format(i),r'E:\deep_learning\handwrittenmathsymbols\data\test\+\+_{0}.jpg'.format(idx))
'Study > Code' 카테고리의 다른 글
python np.linalg.norm() / Vector space calculrate Eucildean (0) | 2018.12.11 |
---|---|
파이썬 이미지 합치기. from PIL import Image (0) | 2018.12.01 |
Python Google translate, py_translator (0) | 2018.11.27 |
python 출력 입력 값 받기. (0) | 2018.11.19 |
Python MM1 queue 파이썬MM1 큐잉 시스템 병렬 (0) | 2018.11.15 |