test07.py 360 B

1234567891011121314
  1. need_check_goods_list=[{
  2. 'id': '1', 'iname': '1'
  3. },{
  4. 'id': '2', 'iname': '2'
  5. },{
  6. 'id': '3', 'iname': '32'
  7. },{
  8. 'id': '3', 'iname': '33'
  9. }]
  10. # 使用字典去重
  11. unique_goods_dict = {item['id']: item for item in need_check_goods_list}
  12. # 将字典转换回列表
  13. need_check_goods_list = list(unique_goods_dict.values())
  14. print(need_check_goods_list)