#! /software/public/python/3.4.3/bin/python3
import sys
import os
filenames = os.listdir(r"./")
for file in filenames:
if "project" in file:
new_file = file.replace("project","new_project")
os.rename(file, new_file)
将脚本拷贝到要替换文件名的文件夹目录下,原文件名“project”替换为“new_project”