I have a list of dictionaries (abbreviated).
my_list = [{ 'id':1, 'val':123 }, {'id':2, 'val':456 }, {'id':2, 'val':789 }]
How can I count the occurrences of dictionaries with a specified value for a particular key (in this case 'id
')? Is there a way to leverage count (my_list.count('id' = 1)
?!?)