appending values into array instead of a list

Aaron Brady castironpi at
Mon Dec 8 21:09:47 CET 2008

On Dec 8, 9:03 am, trias <t.gkikopou... at> wrote:
> Hi,
>  I have this little script:
> So on the above I am appending values from signaldict indexed by i for every
> object in the ref list. This way I calculate the sum of all values with
> similar indexing i value. Would I be able to store the signaldict[i] for
> every line individually in a multidimensional array?  

I think you want arrays of tuples, not parallel arrays.  Just append a
tuple instead of a plain number.

>>> a= []
>>> a.append( ( 10, -1 ) )
>>> a.append( ( 20, -1.1 ) )
>>> a
[(10, -1), (20, -1.1000000000000001)]

For true multidimensional arrays of a uniform type, there is 'numpy'.

More information about the Python-list mailing list