I have a list of dictionaries like so:
data = [{title:'XYZ',url:'www.xyz.com'},{title:'ABC',url:'www.abc.com'},{title:'XYZ',url:'www.def.com'}]
I would like to filter this so that only the non-duplicate titles are retained i.e.:
filtered = [{title:'XYZ',url:'www.xyz.com'},{title:'ABC',url:'www.abc.com'}]
It doesn't matter which duplicate dictionary is retained. I tried
[x for x in data if x['title'] not in data]