python当中如果有一个列表里面是多个字典,且有一对键值对相同,想要求不同的键对应的值之和
摘要:
a = [{"id":1,"count":29},{"id':1,"count":39}] ids = list(set([u["id"] for u in a])) # [1,] b = [] for id in ids: count = 0 for u in a: if id in u.get( 阅读全文
posted @ 2023-04-19 15:58 一先生94 阅读(19) 评论(0) 推荐(0) 编辑