利用python的numpy创建矩阵并对其赋值

  创建一个3X3的矩阵并对其赋值:

x = numpy.array([[1,2,3],[4,5,6],[7,8,9]])
print x
print x.shape

  

  运行结果:

[[1 2 3]
 [4 5 6]
 [7 8 9]]
(3L, 3L)
[Finished in 0.2s]

 

原文地址:https://www.cnblogs.com/anyview/p/5579715.html