python列表内字典去重


version > python3.5

tags = [{"value": "A", "key": "hello"},{"value": "A", "key": "world"}]
b = OrderedDict() for item in tags:   
  b.setdefault(item['value'], {**item, })
tags = list(b.values())

 

posted @ 2019-03-26 16:34  Adamanter  阅读(1155)  评论(0编辑  收藏  举报