当前位置: 代码迷 >> 综合 >> 如何将某个文件夹中的文件批量改名为索引值
  详细解决方案

如何将某个文件夹中的文件批量改名为索引值

热度:0   发布时间:2024-02-24 10:09:47.0
import os
path = 'D:\zxx\contest2\csv_test'
files = os.listdir(path)
for i, file in enumerate(files):NewName = os.path.join(path, str(i))OldName = os.path.join(path, file)os.rename(OldName, NewName)

 

  相关解决方案