array

The array module defines a new object type, array, that works almost exactly like other sequence types, except that its contents are constrained to a single type. The type of an array is determined at the time of creation, using one of the following type codes:

Type CodeDescriptionC TypeMinimum Size (in Bytes)
‘c’8-bit characterchar1
‘b’8-bit integersigned char1
‘B’8-bit unsigned integerunsigned char1
‘u’Unicode characterPY_UNICODE2 or 4
‘h’16-bit integershort2
‘H’16-bit unsigned integerunsigned short2
‘i’Integerint4 or 8
‘I’Unsigned integerunsigned int4 or 8
‘l’Long integerlong4 or 8
‘L’Unsigned long integerunsigned long4 or 8
‘f’Single-precision floatfloat4
‘d’Double-precision floatdouble8

The representation of integers and long integers is determined ...

Get Python: Essential Reference, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.