比如文件名为 1 3 4 5 6 8 34 2 344 重命名后 1 2 3 4 5 6 7 8 9 10
import numpy
as np
import pandas
as pd
from shutil
import copyfile
import os
import json
json_path
= r
"data/13511_json/"
json_save_path
= r
"data/13511_sort.json/"
name
= []
if os
.path
.isdir
(json_path
):
for filename
in os
.listdir
(json_path
):
name
.append
(int(os
.path
.splitext
(filename
)[0]))
name
.sort
()
print(name
)
for i
in range(len(name
)):
copyfile
(json_path
+ str(name
[i
]) + ".json", json_save_path
+str(i
)+".json")
print("finish")
转载请注明原文地址: https://mac.8miu.com/read-516315.html