I have the following function in python
def playersID(self, listDetals):
listPlayersID = []
tempDict = {}
for x in listDetals:
for y in x['result']['players']:
tempDict.clear()
tempDict['match_id'] = x['result']['match_id']
tempDict.update(y)
listPlayersID.append(tempDict)
return listPlayersID
The parameter "listDetals" is a list of Dict and the function return is also a list of Dictionaries with a piece of listDetals in each position. The problem is in the "append" command.
Every time it is called, it fills ALL the list again, instead of just creating a new position at the end of it. Anyone have any idea why this?