Pythonはフォルダ内のファイルの名前を変更します

# coding = 'utf-8'
import os
def rename(path):
    i = 29
   
    FileList = os.listdir(path)
   
    for files in FileList:
       
        os.rename( 'C:\\Users\\**\\Desktop\\pythonp\\chengxu\\aaa\\'+files,'C:\\Users\\**\\Desktop\\pythonp\\chengxu\\aaa\\'+str(i)+'.png')
        i += 1


path = 'C:\\Users\\**\\Desktop\\pythonp\\chengxu\\aaa'
rename(path)

おすすめ

転載: blog.csdn.net/ResumeProject/article/details/114194804