x =[[1,2,3],
[2,4,5],
[3,4,2]]
#不使用numpy转化为标准数组,列表不能使用[:,2]等
x=np.array(x)
print(x[0])
print(x[1])
print(x[:,1])
print(x[2,:])
结果
D:\ProgramFiles\anaconda3\python.exe D:/Python/DeepLearning/test1.py
[1 2 3]
[2 4 5]
[2 4 4]
[3 4 2]
Process finished with exit code 0
x[0],x[1],x[:,1],x[2,:] 区别
最新推荐文章于 2022-10-06 21:23:48 发布