python 一个去除字典列表的重复元素的方法
# 一个去除字典列表的重复元素的方法
list_users = [{'a': 1}, {'b': 2}, {'a': 1}]
list_users = [dict(t) for t in set([tuple(d.items()) for d in list_users])]
# 结果:
[{'b': 2}, {'a': 1}]
# 一个去除字典列表的重复元素的方法
list_users = [{'a': 1}, {'b': 2}, {'a': 1}]
list_users = [dict(t) for t in set([tuple(d.items()) for d in list_users])]
# 结果:
[{'b': 2}, {'a': 1}]
