import os
oldname="e:/old.txt"
newname="e:/new.txt"
os.rename(oldname,newname);
python 如何给文件改名
于 2022-12-26 19:15:42 首次发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)
import os
oldname="e:/old.txt"
newname="e:/new.txt"
os.rename(oldname,newname);