把写内容过程中比较重要的内容做个收藏,下面的内容段是关于python重命名文件的内容。

import oscur_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)