import numpy as np result = np.ndarray([0, 4]) print(result) print(len(result)) a = np.array([1,2,3]) c=np.ndarray([1,2,3]) print (a) print(c) print(c[0]) print(c.shape) print(result.shape)
[]
0
[1 2 3]
[[[6.91616094e-310 6.91616094e-310 6.91616094e-310]
[6.91616094e-310 6.91616094e-310 6.91616094e-310]]]
[[6.91616094e-310 6.91616094e-310 6.91616094e-310]
[6.91616094e-310 6.91616094e-310 6.91616094e-310]]
(1, 2, 3)
(0, 4)
Process finished with exit code 0
由上图程序可以看出,ndarray是创建对应维度的数组的形状容器,array是将()内的转换为数组