【发布时间】:2021-12-12 07:43:42
【问题描述】:
我有一个 2D 列表(列表列表)并尝试使用符号 list[:,colIndex] 将单个列的数据提取到另一个列表中,但我收到了 TypeError: list indices must be integers 错误。
例如:
lst = [[1,2,3],[10,12,13]]
lst[:,0]
返回:
Traceback (most recent call last):
File "<input>", line 2, in <module>
TypeError: list indices must be integers
我不明白...
编辑: 在 Python 3.9 中运行它给了我:
TypeError: list indices must be integers or slices, not tuple
【问题讨论】:
标签: jython-2.7