list_label = []
for file in os.listdir("./"):
if file.endswith(".json"):
with open(file,'rb') as load_f:
load_dict = json.load(load_f)
temp = load_dict['shapes']
for i in range(len(temp)):
a = temp[i]['label']
list_label.append(a)
set01 = set(list_label)
dict01 = {}
for item in set01:
dict01.update({item:list_label.count(item)})
python统计json文件中标签个数
最新推荐文章于 2024-03-04 14:38:32 发布