LutherRevisited wrote:
I'm wanting to do something with a list that is basically a 2 dimensional
array.  I'm not so good with lists so can someone give me an example of how I
might implement this in Python?  thanks.

If you're planning to do anything serious with a 2D array, you should probably look at numarray:
http://www.stsci.edu/resources/software_hardware/numarray


>>> import numarray as na
>>> arr = na.array(range(10), shape=(5, 2))
>>> arr
array([[0, 1],
       [2, 3],
       [4, 5],
       [6, 7],
       [8, 9]])
>>> arr[0,1]
1
>>> arr[4,0]
8

If you're not doing any heavy computation, you can probably do this with nested lists:

>>> arr = [[0, 1],
...        [2, 3],
...        [4, 5],
...        [6, 7],
...        [8, 9]]
>>> arr[0][1]
1
>>> arr[4][0]
8

Steve
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to