2023年4月19日

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) 编辑

python当中的""和None,记一次小坑

摘要: 在模型类当中,比如定义了,可以传入空值: class Person(models.Model): name = models.CharField(verbose_name='姓名',max_length=32) age= models.IntegerField(verbose_name='年龄',b 阅读全文

posted @ 2023-04-19 15:52 一先生94 阅读(61) 评论(0) 推荐(0) 编辑

导航