python取二维数组中的某一列

list a=[[1,2,3], [4,5,6]] a[:, 0] # 尝试用数组的方法读取一列失败 TypeError: list indices must be integers or slices, not tupleweb numpy array 转为array便可 a = np.array(a) a[:, 0] array([1, 4])数组 array转list a.tolist()s
相关文章
相关标签/搜索