I have a list of dicts:
[{'name':'A', 'flag':'2','id':'x1'},
{'name':'A', 'flag':'2','id':'x2'},
{'name':'A','flag':'1','id':'x3'},
{'name':'B', 'flag':'2','id':'x4'}]
I want an output like :
[{'name':'A', 'flag':'2','id':'x1'},
{'name':'A', 'flag':'1','id':'x3'},
{'name':'B', 'flag':'2','id':'x4'}]
Remove duplicate dicts from list where : field name and flag are the same.
For example the second dict will be deleted because its a semi-duplicate with the first one same name, same flag (different ids but we dont care about ids: the idea is to delete al dict which have same name and same flag and keep only one of them
I can use nested loops but dont know if i can use list comprehension !?