에있는 파일의 이름을 변경/문자열의 이름을 변경 : 숫자 (2 자) 패딩과 내가 이름을 인쇄하고 싶은나는 아래와 같은 파일들을 가지고 파이썬
_1 blank file_
_10 - blank file_
_11 - blank file_
_2 blank file_
_3 blank file_
을 내가 가진 :
PATH = "/Users/seth/python/test"
#
#
for (path, dirs, files) in os.walk(PATH):
for z in files:
filename = z.replace(" ","_").replace("-","").replace("__","_")
print filename
원하는 출력 :
_01_blan k_file_
_02_blank_file_
_03_blank_file_
_10_blank_file_
_11_blank_file_
당신이 원하는 출력에 게시물을 업데이트 할 수 있습니까? – sholsapp