#-*-coding:gbk-*-
import os
cur_path = os.getcwd()
lists = os.listdir( cur_path )
for f in lists:
if f != 'ren.py':
print cur_path
cur_file = cur_path + '\\' + f
new_file = cur_file.replace( '副本', '' )
os.rename(cur_file, new_file)
python 重命名文件
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
上一篇:mongodb数据增加和查找
下一篇:分治法
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Python 函数命名最佳实践
Python 函数命名最佳实践
python Python 内置函数 -
python给文件重命名 python重命名
方法一(os.listdir):使用此种方法会将父文件夹下的所有文件(无论文件还是文件夹)一起重命名,再下一级的文件不受影响。1. 加前缀/后缀比如,我们需要在Test2文件夹下,将子文件(无论文件还是文件夹)批量加上前缀“test-”。
python给文件重命名 Python 文件夹重命名 文件夹批量改名 文件夹批量重命名