I am looking for a way to sort my array of array which has a complex structure :
L=[[
[[1,1,1,1,1,1,1],1,56],
[[6,6,6,6,6,6,6],1,3],
[[3,3,3,3,3,3,3],1,54]],
[[[2,2,2,2,2,2,2],2,42],
[[5,5,5,5,5,5,5],2,6]]]
I woul'd like to sort it by the last elements meaning (56, 3, 54 and 42, 6). What I want to get it is that :
L=[[
[[6,6,6,6,6,6,6],1,3],
[[3,3,3,3,3,3,3],1,54],
[[1,1,1,1,1,1,1],1,56]],
[[[5,5,5,5,5,5,5],2,6],
[[2,2,2,2,2,2,2],2,42]]]
I have already tried : L.sort(key=lambda x: x[0][0][2])
but it doesn't work...
I have seen those advices but I haven't succeeded in making it work :
How to sort a list of lists by a specific index of the inner list?
Any help would be appreciated ! Thanks in advance !