This section covers numbers, strings, lists, dictionaries, tuples, and files. Compound data types (e.g., lists, dictionaries, tuples) can nest inside each other arbitrarily.
This section covers basic number types (integers, floating-point), as well as more advanced types (complex, unlimited-precision long integers).
Numbers are written in a variety of numeric constant forms:
1234, -24, 0
Normal integers (C longs, at least 32 bits)
Long integers (unlimited size)
1.23, 3.14e-10, 4E210, 4.0e+210
Floating-point (C doubles)
Octal and hex integer constants
3+4j, 3.0+4.0j, 3J
Number types support all number operations (see Table 1-6). In mixed-type expressions, Python converts operands up to the type of the “highest” type, where integer is lower than long, which is lower than floating-point, which is lower than complex.
In 2.2, integer operations are automatically promoted to longs
instead of overflowing, and there are two flavors of division
Strings are immutable (unchangeable) arrays of characters, accessed by offset.
Strings are written as a series of characters in quotes:
Double and single quotes work the same, and each can embed unescaped quotes of the other kind.
"""This is a
Triple-quoted blocks collect lines into a single string, with end-of-line markers between the original lines.
Backslash escape code sequences (see ...