Python docs 3.4 List 101

Using the Python Interpreter.

Python knows a number of compound data types, used to group together other values. The most versatile is the list, which can be written as a list of comma-separated values (items) between square brackets. Lists might contain items of different types, but usually the items all have the same type.

Like strings (and all other built-in sequence type), lists can be indexed and sliced.

Unlike strings, which are immutable, lists are a mutable type, i.e. it is possible to change their content.

You can also add new items at the end of the list, by using the append() method.

Assignment to slices is also possible, with add or remove.

The built-in function len() also applies to lists.
It is possible to nest lists (create lists containing other lists).




Comments Off on Python docs 3.4 List 101