Name

array

Synopsis

array(seq,typecode)

seq is any Python sequence. typecode is either a Java class or a single character (specifying a primitive Java type according to Table 25-1). array creates a Java array a with the same length as seq and elements of the class or type given by typecode. array initializes a’s elements from seq’s corresponding items.

Table 25-1. Typecodes for the jarray module

Typecode

Java type

'b'
byte
'c'
char
'd'
double
'f'
float
'h'
short
'i'
int
'l'
long
'z'
boolean

Get Python in a Nutshell 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.