[Tutor] Help me with two dimensional arrays in Python
Kent Johnson
kent37 at tds.net
Wed Oct 4 19:56:10 CEST 2006
Asrarahmed Kadri wrote:
>
> I am looking for something like this:
>
> int arr[5][5]; // C statement; declaring an array of 5 * 5 size
>
> Is there an easy and clean way to achieve this in python???
Can you say something about your use case? If I had to guess I would say
numpy is what you are looking for. Did you look at my suggestions? Are
you a Python beginner?
Kent
>
> Thanks
>
>
>
> On 10/4/06, *Kent Johnson* <kent37 at tds.net <mailto: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:
> http://www.python.org/doc/faq/programming/#how-do-i-create-a-multidimensional-list
> <http://www.python.org/doc/faq/programming/#how-do-i-create-a-multidimensional-list>
>
> 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:
> http://numpy.scipy.org//
>
> Kent
>
>
>
>
> --
> To HIM you shall return.
More information about the Tutor
mailing list