[Tutor] Help me with two dimensional arrays in Python

Kent Johnson kent37 at tds.net
Wed Oct 4 16:05:37 CEST 2006

Asrarahmed Kadri wrote:
> Hi folks,
> I am stuck.. Please help me with implementing two dimensional array in 
> Python.

Nested lists are the simplest way though beware the gotcha shown here:

You can also use a dict with tuple indices, e.g.
d[1,2] = 3

Numpy is an extension designed for high-performance numerical work, it 
includes a multidimensional array type:


More information about the Tutor mailing list