multi arrays in python
i need to create a multi array (matrix) and i have no idea how to do it :/ i have a variable named x and i want to create on this variable an array with double index (10x10) of integer.
any1 can halp me? it is possible in python?
Your gonna have to give me a little more info about what your trying to do, if you mean an array within an array then..
you can stick as many arrays of any value inside other array as you like. and access them in the same way i.e to get the value 1 you would use array and so on.
array = [[1, 2],[3, 4],[5, 6],[7, 8],[9, 10],[11, 12],[13, 14]]
Oh, future ref' an array in Python is called a list
Hope this helps,
July 10th, 2003, 06:20 PM
actually, there is an array module in python's standard library, but it only holds one datatype (like arrays in java/c/c++)
but, multidimentional lists aren't builtin to python, but they can be created/indexed easily enough
July 11th, 2003, 09:28 AM
You probably want to use the the Numeric module which has an array type built in just for creating and manipulating matrices.
Actually this is the link to numarray which is the newer module which is going to be phasing out Numeric.
It's much faster than using lists to represent matrices and much more memory efficient, lists are memory hogs. Also it has tons of built in functions to help you manipulate matrices.
Hope this helps.