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 12, “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 11.2, “List comprehensions”.
Lists support all the operations described under Section 8.1, “Operations common to all the sequence types”. Methods available on lists are discussed in Section 11.1, “Methods on lists”.
There are a number of functions that can be used with lists as well:
Section 20.2, “all(): Are all the elements of an
iterable true?”.
Section 20.3, “any(): Are any of the members of an
iterable true?”.
Section 20.12, “enumerate(): Step through indices and
values of an iterable”
Section 20.14, “filter(): Extract qualifying elements
from an iterable”.
Section 20.21, “iter(): Produce an iterator over a
sequence”.
Section 20.25, “map(): Apply a function to each
element of an iterable”.
Section 20.33, “range(): Generate an arithmetic
progression as a list”.
Section 20.46, “xrange(): Arithmetic progression
generator”.