data_list = [{"a": "123", "b": "321"}, {"a": "123", "b": "321"}, {"b": "321", "a": "23"}]


seen = set()
new_l = []
for d in data_list:
    t = tuple(d.items())
    if t not in seen:
        seen.add(t)
        new_l.append(d)
print(new_l)  # [{'a': '123', 'b': '321'}, {'b': '321', 'a': '23'}]
raw_list = [
            ["百度", "CPY"],
            ["百度", "CPY"],
            ["京东", "CPY"],
            ["百度", "CPY", ]
        ]
new_list = [list(t) for t in set(tuple(_) for _ in raw_list)]
new_list.sort(key=raw_list.index)
print(new_list)     # [['百度', 'CPY'], ['京东', 'CPY']]

 

相关文章:

  • 2021-12-30
  • 2022-12-23
  • 2021-10-13
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-25
  • 2022-01-07
相关资源
相似解决方案