[MATRIX-SIG] array([0,1,2,3]).reverse()

Timothy A. Hochberg hochberg@wwa.com
Fri, 15 Aug 1997 19:02:05 -0500 (CDT)


On Fri, 15 Aug 1997, Jean-Bernard ADDOR wrote:

> Hy!
> 
> How to obtain an array in the reverse order ?
> If i have array([0,1,2,3])
> I want array([3,2,1,0]).

Try:

a = array([0,1,2,3])
b = a[::-1]
b # should give [3,2,1,0]

 ____   
  /im  

+------------------------------------------------+
|Tim Hochberg            Research Assistant      |
|hochberg <at> wwa.com   University of Illinois  |
|                        Electrical Engineering  |
+------------------------------------------------+


_______________
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________