import numpy as np a=[ [1,12,13,14], [2,22,23,24], [3,32,33,34], [4,42,43,44] ] a=np.array(a) print("获取列表的任意列") print(a[:,[3,2,1,0,0]]) print("获取列表的任意行") print(a[[3,2,1,0,0]])
python获取列表的任意行任意列
最新推荐文章于 2024-09-04 09:21:13 发布
import numpy as np a=[ [1,12,13,14], [2,22,23,24], [3,32,33,34], [4,42,43,44] ] a=np.array(a) print("获取列表的任意列") print(a[:,[3,2,1,0,0]]) print("获取列表的任意行") print(a[[3,2,1,0,0]])