I am trying to have the same behaviour, but I want to check if url
dict contains unique values instead of checking the complete dict.
def unique(data):
result = {}
for key, value in data.items():
new_list = []
for item in value:
if item not in new_list:
new_list.append(item)
result[key] = new_list
return result
games = {
"games":[
{
"city":"Santa Monica, CA",
"company":"rockstar",
"date":{
"display":"24 days ago",
"timestamp":1570721082
},
"game":"akakkak",
"challenge":"leel",
"url":"https://www.game.com/12757a575/aaashs/2222"
},{
"city":"Santa Monica, CA",
"company":"rockstar",
"date":{
"display":"24 days ago",
"timestamp":1570721082
},
"game":"akak2kak",
"challenge":"leel",
"url":"https://www.game.com/12757a575/aaashs/2222"
}
]
}
print(unique(games))
I expect the output of "url":"https://www.game.com/12757a575/aaashs/2222"
without having the same value in the same key