Next: math Prev: __main__ Up: Built-in Modules Top: Top
array
'c'
'b'
'h'
'i'
'l'
'f'
'd'
The module defines the following function:
fromlist()
or fromstring()
method (see below) to add
initial items to the array.
EOFError
is raised, but the items that were
available are still inserted into the array.
for x in list: a.append(x)
except that if there is a type error, the array is unchanged.
fromfile()
method).
tofile()
method.)
array(typecode, initializer)
. The
initializer is omitted if the array is empty, otherwise it is a
string if the typecode is 'c'
, otherwise it is a list of
numbers. The string is guaranteed to be able to be converted back to
an array with the same type and value using reverse quotes
(``
). Examples:
array('l')
array('c', 'hello world')
array('l', [1, 2, 3, 4, 5])
array('d', [1.0, 2.0, 3.14])