def sort_multi_len_data(unsorted_data):
temp_dict = dict()
final_list = list()
datalist = list()
for i in unsorted_data:
length = str(len(i[‘display_name‘]))
if length in temp_dict:
temp_dict[length].append(i)
else:
temp_dict[length] = list()
temp_dict[length].append(i)
sort_dic = sorted(temp_dict.iteritems(), key=lambda d:d[0])
for i in sort_dic:
final_list.append(sorted(i[1],key=lambda d: d[‘display_name‘]))
for items in final_list:
for item in items:
datalist.append(item)
return datalist
时间: 2024-10-18 01:53:41