我在名为test_1999.0000_seconds.vtk
的文件夹中有一些文件。我想要做的是将文件名更改为test_1999.0000.vtk
。
答案 0 :(得分:3)
您可以使用os.rename
jQuery("td.jz-pl select").change(function() {
jQuery(this).closest('tr').find('td.jz-en select').css('background-color','red');
});
答案 1 :(得分:0)
import os
currentPath = os.getcwd() # get the current working directory
unWantedString = "_seconds"
matchingFiles =[]
for path, subdirs, files in os.walk(currentPath):
for f in files:
if f.endswith(".vtk"): # To group the vtk files
matchingFiles.append(path+"\\"+ f) #
print matchingFiles
for mf in matchingFiles:
if unWantedString in mf:
oldName = mf
newName = mf.replace(unWantedString, '') # remove the substring from the string
os.rename(oldName, newName) # rename the old files with new name without the string