python改文件名
import os file_names = os.listdir('D:\\mobilefile\\_hd') for file_name in file_names : print(file_name) print(file_name[:-1]) os.renames("D:\\mobilefile\\_hd\\"+file_name,"D:\\mobilefile\\_hd\\"+file_name[:-1])
import os file_names = os.listdir('D:\\mobilefile\\_hd') for file_name in file_names : print(file_name) print(file_name[:-1]) os.renames("D:\\mobilefile\\_hd\\"+file_name,"D:\\mobilefile\\_hd\\"+file_name[:-1])