你如何在python中对元组列表列表进行排序
例如:注意元组的最后一个元素是相同的
a = [
[(1, 5, 6), (2, 2, 6), (3, 6, 6)],
[(6, 1, 3), (5, 7, 3), (4, 1, 3)],
[(5, 7, 2), (7, 5, 2), (6, 3, 2)],
[(9, 1, 7), (1, 5, 7), (2, 6, 7)]
]
我想使用元组的最后一个元素作为键进行排序。所以预期的结果是
[
[(5, 7, 2), (7, 5, 2), (6, 3, 2)],
[(6, 1, 3), (5, 7, 3), (4, 1, 3)],
[(1, 5, 6), (2, 2, 6), (3, 6, 6)],
[(9, 1, 7), (1, 5, 7), (2, 6, 7)]
]