sjmachin at lexicon.net
Tue Nov 13 07:58:20 CET 2007
> On 12 nov, 20:19, "Gordon C" <gc... at vif.com> wrote:
> > Absolute newbie here. In spite of the Python Software Foundation tutorial's
> > (http://www.python.org/doc/current/tut/tut.html) use of the array
> > declaration
> > array(type[,initializer]), the Python interpreter does NOT accept the word
> > array! It , presumably, needs to have an import <something> included. Could
> > some show me how to declare arrays with some basic examples?
> > Gord.
> hey Gordon,
> here's a good reading for you: http://effbot.org/zone/python-list.htm
Hey Bernard, read Gordon's message carefully; he's asking about
arrays, not lists.
Hey Gordon, You seem a little lost; here's the tutorial reference:
The array module provides an array() object that is like a list that
stores only homogenous data and stores it more compactly. The
following example shows an array of numbers stored as two byte
unsigned binary numbers (typecode "H") rather than the usual 16 bytes
per entry for regular lists of python int objects:
>>> from array import array
>>> a = array('H', [4000, 10, 700, 22222])
array('H', [10, 700])
The 2nd word (array) is a link (http://docs.python.org/lib/module-
array.html) to the docs for the array module.
More information about the Python-list