私は簡単であるべきだと思う何をやろうとしている:2Dスライスを行う方法は?
私は2Dのリスト作り:
a = [[1,5],[2,6],[3,7]]
を、私は最初column
を引き出したいとしようとした:
1)
a[:,0]
...
TypeError: list indices must be integers or slices, not tuple
2)
a[:,0:1]
...
TypeError: list indices must be integers or slices, not tuple
3)
a[:][0]
[1, 5]
4)
a[0][:]
[1, 5]
5)はそれを得たが、これはそれを行うための方法ですか?
aa[0] for aa in a
numpy
を使用すると簡単ですが、Pythonの方法は何ですか?
の[リストのリストの内側のリストからn番目の要素を取得するの'私には正常に見える –
可能な重複[におけるAAのためのAA [0] Pythonで](http://stackoverflow.com/questions/13188476/get-the-nth-element-from-the-inner-list-of-a-list-of-lists-in-python) – Himaprasoon