Slicing matrix

Anthony Liu antonyliu2002 at yahoo.com
Mon Apr 17 22:04:38 EDT 2006


I am using numarray.

Suppose I have

>>> p = array(range(25), shape=(5,5))
>>> p
array([[ 0,  1,  2,  3,  4],
       [ 5,  6,  7,  8,  9],
       [10, 11, 12, 13, 14],
       [15, 16, 17, 18, 19],
       [20, 21, 22, 23, 24]])

How do I easily slice out [0,1,2] or [1,2,3] or
[2,7,12] or [7,12,17] and put it in a list?

I checked the documentation at
http://www.esrf.fr/computing/bliss/python2/NumArray/html/node26.html
, but could not get it.

Thanks.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Python-list mailing list