Python Forum
Access 2D array problem - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: Access 2D array problem (/thread-1731.html)



Access 2D array problem - landlord1984 - Jan-23-2017

I got:

SortedArray2D= [['a', 'b', 'c', 'd', 'e'], ['f', 'g', 'h', 'i', 'j'], ['k', 'l', 'm', 'n', 'o'], ['p', 'q', 'r', 's', 't'], ['u', 'v', 'w', 'x', 'y']]
print(SortedArray2D[:][1])
gives
Quote:['f', 'g', 'h', 'i', 'j']

and
print(SortedArray2D[1][:])
also gives
Quote:['f', 'g', 'h', 'i', 'j']


If I want to 2D array access without numpy, how can I solve this?

I know we can do SortedArray2D[i][j], can't we do SortedArray2D[:][j]?


RE: Access 2D array problem - buran - Jan-23-2017

actually, what do you want to achieve?