MyAI

Arrays

Python’s standard data types list, tuple and string are sequences. A sequence object is an ordered collection of items. Each item is characterized by incrementing index starting with zero. Moreover, items in a sequence need not be of same type. In other words, a list or tuple may consist of items of different data type.

An array is also an indexed collection of items, but the items must be of similar data type.

Syntax:

import array
obj = array.array(typecode[, initializer])

Ex:

a = arr.array('i', [1, 2, 3])

Joining Array


Main Page   Next Chapter: Python - Oops