Python Forum

Full Version: Access 2D array problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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]?
actually, what do you want to achieve?