重命名文件
作者:互联网
1 import os 2 3 def renameFile(): 4 try: 5 os.rename(srcFile,dstFile) 6 except Exception as e: 7 print(e) 8 print('rename file fail\r\n' + srcFile ) 9 else: 10 print('rename file success\r\n' + dstFile ) 11 12 if __name__=="__main__": 13 srcFile = 'D:/111.xls' 14 dstFile = 'D:/222.xls' 15 renameFile()
标签:重命名,文件,renameFile,srcFile,rename,__,print,dstFile 来源: https://www.cnblogs.com/mingruifeng/p/16328684.html