Taking a oldList
I thought in compare each Key
value, example: T1==T1
take Id, like:
oldList= [
{"Id":1, "Key":["T2","T1"]},
{"Id":2, "Key":["T3","T5"]},
{"Id":3, "Key":["T2"]},
{"Id":4, "Key":["T3","T1"]},
{"Id":5, "Key":["T2","T4"]},
{"Id":6, "Key":["T2","T1","T3"]},
]
for i in lista_2:
for KeyId in i["Key"]:
if KeyId == KeyId :
#grab Id
That's not work, I'm trying to create this resulted:
newList = [
{"Key":"T1","Ids":[1,4,6]}
{"Key":"T2", "Ids":[1,3,5]}
...
]
In nutshell, I have to say which, T1
has these Ids