I have defined a tuple thus: (slot, gameid, bitrate)
and created a list of them called myListOfTuples
. In this list might be tuples containing the same gameid
.
E.g. the list can look like:
[
(1, "Solitaire", 1000 ),
(2, "Diner Dash", 22322 ),
(3, "Solitaire", 0 ),
(4, "Super Mario Kart", 854564 ),
... and so on.
]
From this list, I need to create a dictionary of pairs - ( gameId
, bitrate
), where the bitrate
for that gameId
is the first one that I came across for that particular gameId
in myListOfTuples
.
E.g. From the above example - the dictionary of pairs would contain only one pair with gameId
"Solitaire" : ("Solitaire", 1000 )
because 1000 is the first bitrate found.
NB. I can create a set of unique games with this:
uniqueGames = set( (e[1] for e in myListOfTuples ) )