if __name__ == '__main__':
from numpy import *
a = mat([[0, 0, 0, 2, 2],
[0, 0, 0, 3, 3],
[0, 0, 0, 1, 1],
[1, 1, 1, 0, 0],
[2, 2, 2, 0, 0],
[5, 5, 5, 0, 0],
[1, 1, 1, 0, 0]])
print(a[:,3])
print(type(a[:,3]))
print(a[:,3].A)
print(type(a[:,3].A))
'''
[[2]
[3]
[1]
[0]
[0]
[0]
[0]]
<class 'numpy.matrixlib.defmatrix.matrix'>
[[2]
[3]
[1]
[0]
[0]
[0]
[0]]
<class 'numpy.ndarray'>#数组类型
'''
转载于:https://www.cnblogs.com/flyingcr/p/10326914.html