I was wondering how to reverse a list of lists in python. For example,
Original: list = [[1,2,3],[4,5,6],[7,8,9]]
Output: new_list = [[7,8,9],[4,5,6],[1,2,3]]
Right now, I am trying this:
new_list = reversed(list)
However, this doesn't seem to work.
In [24]: L = [[1,2,3],[4,5,6],[7,8,9]]
In [25]: L[::-1]
Out[25]: [[7, 8, 9], [4, 5, 6], [1, 2, 3]]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With