P16
"""第一行和最后一行的1,3,4列""" a = np.arange(12).reshape(3, 4) # 先获取第一行与最后一行,所有列 a = a[[0, -1], :] #在获取所有行的指定列 a = a[:, [0, 2, 3]] print(a)