pzx-web-api/app/util/common.py

16 lines
322 B
Python
Raw Normal View History

2023-08-10 12:27:18 +08:00
import os
from itertools import groupby
from operator import itemgetter
def split_group(dict_list, key):
dict_list.sort(key=itemgetter(key))
tmps = groupby(dict_list, itemgetter(key))
result = []
for key, group in tmps:
result.append({key: list(group)})
return result
basedir = os.getcwd()