hello all i have a problem with a problem in python. I have a dictionary inside an array and I want to remove all duplicate keys and values from the array. My code is:
color=[{"key":"orange","value":1},{"key":"orange","value":1},{"key":"violet","value":2}]
new_color={}
for i in color:
if i["key"] not in i:
new_color.setdefault("key",[]).append(i["key"])
new_color.setdefault("value",[]).append(i["value"])
print(new_color)
for example i want the output to be:
color=[{"key":"orange","value":1},{"key":"violet","value":2}]
How can i do?