直接切片是不行的:
>>> a=[[1,2,3], [4,5,6]] >>> a[:, 0] # 尝试用数组的方法读取一列失败 TypeError: list indices must be integers or slices, not tuple 我们可以直接构造:
>>> b = [i[0] for i in a] # 从a中的每一行取第一个元素。 >>> print(b) [1, 4] 文章来源: python 二维列表按列取元素。