我有一个spimple脚本来重命名目录中的所有文件(例如475435_名称.psd)把它的数量增加10个。在
但我有个错误
Traceback (most recent call last):
File "C:/Users/mstopienski/Desktop/Desktop/test.py", line 12, in <module>
os.rename(filename, newname)
FileNotFoundError: [WinError 2] The system cannot find the file specified: '810858_Hero_ProjectHP_1600x487.psd' -> '810868_Hero_ProjectHP_1600x487.psd'
我不想它移动文件我只想改变名字。在
^{pr2}$
你需要仔细查看输入的路径,看看文件是否以“.psd”结尾, 尝试此代码段将有助于:
我把脚本和你的psd文件放在同一个路径输入“/”就行了。在
根据@RvrK的评论,脚本试图将重命名的目标指向工作目录,所以我猜最后一行改为:
应该这么做吗?在
编辑:
添加一些“安全”功能:
^{pr2}$相关问题 更多 >
编程相关推荐