user33899 user33899 -4 years ago 129
Python Question

How to reverse 2d list in python?

This is my 2d list:

numbers = [(1,2,3,4,5),(6,7,8,9,10),(11,12,13,14,15)]


What I want to get is this:

numbers = [(15,14,13,12,11),(10,9,8,7,6),(5,4,3,2,1)]


The only method I know is this:

for i in numbers[::-1]:
print(i)


Can anyone help?

Answer Source
print([i[::-1] for i in numbers[::-1]])
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download