import numpy as npb=np.arange(24)a=b.reshape(2,3,4)print aprint a[0,:,0]
b=np.arange(24)a=b.reshape(2,3,4)print aprint '--------------------'print a[:,0]
结果:
[[ 0 1 2 3] [12 13 14 15]]
b=np.arange(24)a=b.reshape(2,3,4)print aprint '--------------------'print a[:,:,0]
结果:
[[ 0 4 8] [12 16 20]]
b=np.arange(24)a=b.reshape(2,3,4)print aprint '--------------------'print a[:,:,0:2]
结果:
[[[ 0 1] [ 4 5] [ 8 9]] [[12 13] [16 17] [20 21]]]