So, I have a list of lists in python like so:
[[a, foo, bar], [a, dog, cat], [b, foo, bar], [c, foo, bar]]
And I want to condense it in to the following:
[[a, bar, cat], [b, bar], [c, bar]]
Where the last two indexes of the 'a' object are the 3rd columns from the first and second instances of the 'a' object in the original list.
How could I go about doing this?
Aucun commentaire:
Enregistrer un commentaire