list内包含dict 去重
def _remove_duplicate(self, dict_list):
seen = set()
new_dict_list = []
for dict in dict_list:
t_dict = {'res_model': dict['res_model'], 'res_id': dict['res_id']}
t_tup = tuple(t_dict.items())
if t_tup not in seen:
seen.add(t_tup)
new_dict_list.append(dict)
return new_dict_list
纯list去重
l1 = [1,4,4,2,3,4,5,6,1]
l2 = list(set(l1))