Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python reverse 2d list

>>> a = [[6, 5, 4], [3, 2, 1]]				# 2d array
>>> print([i[::-1] for i in a[::-1]])		# reverse each element in the arrays and the arrays themselves		
# output: [(1, 2, 3), (4, 5, 6)]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #reverse #list
ADD COMMENT
Topic
Name
6+5 =