[Tutor] Help me with two dimensional arrays in Python
mwhite3 at ttsd.k12.or.us
Wed Oct 4 19:55:19 CEST 2006
How about something like this:
>>> arr = 
>>> arr.append(['Blue', 'Yellow', 'Green', 'Brown', 'White'])
>>> arr.append(['Up', 'Down', 'Left', 'Right', 'Center'])
Is this what you were thinking of?
On Wed, Oct 04, 2006 at 06:38:09PM +0100, Asrarahmed Kadri (ajkadri at googlemail.com) wrote:
> I am looking for something like this:
> int arr; // C statement; declaring an array of 5 * 5 size
> Is there an easy and clean way to achieve this in python???
> On 10/4/06, Kent Johnson <kent37 at tds.net> wrote:
> >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:
> To HIM you shall return.
> Tutor maillist - Tutor at python.org
More information about the Tutor