how to select one column of a matrix?

7 views
Skip to first unread message

truerenwang

unread,
Sep 19, 2014, 11:01:50 AM9/19/14
to psychology-...@googlegroups.com
Hi everybody, 

I have a question about how to select a column of a matrix in python.
For example:

matrix =[[1,4,3,2],
             [2,3,1,4],
             [4,1,2,3],
             [3,4,1,2]]
if I want to select the first row, I can just type

print matrix[0][:]

and it gives me [1,4,3,2]. But how can I get the first column [1,2,4,3]? I tried 

print matrix[:][0]

but it still gives me [1,4,3,2]


Reply all
Reply to author
Forward
0 new messages