时间:2020-10-14 15:00:25 | 栏目:Python代码 | 点击:次
如下所示:
def list_dict_duplicate_removal(): data_list = [{"a": "123", "b": "321"}, {"a": "123", "b": "321"}, {"b": "321", "a": "123"}] run_function = lambda x, y: x if y in x else x + [y] return reduce(run_function, [[], ] + data_list) if __name__ == '__main__': print list_dict_duplicate_removal()
输出结果:
[{'a': '123', 'b': '321'}]