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)

你可能感兴趣的:(数据分析)