0
모두 이름이 바뀌고 있지만 첫 번째 파일의 이름에는 공백이 있습니다.첫 번째 파일 이름의 앞에는 공백이옵니다.
이 내 코드 :
import os
def dtr(x, y):
os.chdir(str(x))
c = os.listdir()
c1 = str(c).replace(str(y), "")
c_1 = c1.replace("[", "")
c_2 = c_1.replace("]", "")
c_3 = c_2.replace("'", "")
c_dtr = c_3.split(",")
x = 0
while x < len(c):
os.rename(c[x],c_dtr[x])
x += 1
dzn = input("Dizin: ")
dgtr = input("Değiştir: ")
dtr(dzn, dgtr)
input()
샘플 입력, 얻어진 출력 및 예상 출력을 제공하십시오. –
왜'os.listdir()'에 의해 반환 된리스트에서 하나의 문자열을 만들고 있습니까? –