Name
array
Synopsis
array(typecode,init='')
Creates and returns an array object
a with the given
typecode. init
can be a plain string whose length is a multiple of
itemsize; the string’s bytes,
interpreted as machine values, directly initialize
a’s items. Alternatively,
init can be a list (of characters when
typecode is 'c',
otherwise of numbers): each item of the list initializes one item of
a.
Array
objects expose all the methods and operations of mutable sequences,
as covered in Chapter 4, except method
sort. Concatenation (with both
+ and extend) and assignment to
slices require both operands to be arrays with the same type code
(i.e., there is no implicit coercion between sequences). In addition
to the methods of mutable sequences, an array
object a also exposes the following
methods.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access