import numpy as np A = np.matrix([[1,2,3],[4,5,6]]) # To get a line from matrix: print(A[0]) # ==> [[1 2 3]] # To get a column: print(A[:,0]) # ==> [[1] # [4]]