To form values into a sequence, use Python's list type if you are going to change, delete, or
add values to the sequence. For a discussion of when to
use list and when to use tuple, see Section 7.5, “Type tuple: Immutable sequences”.
To create a list, enclose a list of zero or more
comma-separated values inside square brackets,
“[...]”. Examples:
[] ["baked beans"] [23, 30.9, 'x']
You can also create a list by performing specific operations on each element of some sequence; see Section 7.4.2, “List comprehensions”.
Lists support all the operations described under Section 7.1, “Operations common to all the sequence types”. Methods available on lists are discussed in Section 7.4.1, “Methods on lists”.
There are a number of functions that can be used with lists as well:
Section 13.2, “all(): Are all the elements of a
sequence true?”.
Section 13.3, “any(): Are any of the members of a
sequence true?”.
Section 13.10, “enumerate(): Step through indices and
values of a sequence”
Section 13.12, “filter(): Extract qualifying elements
from a sequence”.
Section 13.17, “iter(): Produce an iterator over a
sequence”.
Section 13.21, “map(): Apply a function to each
element of a sequence”.
Section 13.28, “range(): Generate an arithmetic
progression as a list”.
Section 13.41, “xrange(): Arithmetic progression
generator”.