Declaring an array of a specific size?

Michael Schuerig schuerig at acm.org
Mon Mar 20 18:54:46 CET 2000


Alex <alex at somewhere.round.here> wrote:

> > 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') >>>

Yes, that does it. Thanks! But, I'm wondering, how would a newbie such
as I am, have found this?

Michael

-- 
Michael Schuerig
mailto:schuerig at acm.org
http://www.schuerig.de/michael/



More information about the Python-list mailing list