import os
def renameFile():
fileList = os.listdir(r"C:\Users\dell\Desktop\Udacity\prank\prank")
print(fileList)
# get current work path
currentpath = os.getcwd()
print("Current is "+currentpath)
# change current work path
os.chdir(r"C:\Users\dell\Desktop\Udacity\prank\prank")
for fileName in fileList:
print("Original is " + fileName)
# delete 0123456789 in file name
os.rename(fileName, fileName.translate(
Python-修改文件夹下所有文件的名字
最新推荐文章于 2025-09-17 13:30:10 发布

881

被折叠的 条评论
为什么被折叠?



