Declaring an array of a specific size?

Alex alex at somewhere.round.here
Sun Mar 19 15:41:35 EST 2000


> I need an integer array with 24 elements and I'm at a loss finding out
> how to do this elegantly.

Would 

array.array("i", 24 * [0])

do the trick?

Also, in the Numeric package, there is something that might help:

>>> from Numeric import zeros
>>> zeros (24, 'i')
array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],'i')
>>> 

Alex.



More information about the Python-list mailing list