Next / Previous / Contents / TCC Help System / NM Tech homepage

5. Basic types

Here is a list of the most common Python types. For a full list, see the types module below.

Type nameValuesExamples

int

Integers in the range [-2147483648, 2147483647]. See the int type below.

42, -3

long

Integers of any size, limited only by total memory size. See the long type below.

42L, -3L, 10000000000000L

float

Floating-point numbers. See the float type below.

-3.14159, 6.0235e23

complex

Complex numbers. See the complex type below.

(3.2+4.9j), (0+3.42e-3j)

str

Ordinary strings of ASCII characters. If you use three sets of quotes around a string, it can extend over multiple lines. See the str type below.

'Fred', "", '''...''', """..."""

unicode

Strings of Unicode characters, an extended international character set. See the unicode type below.

u'Fred', u'\u03fa'

list

A sequence of values that is mutable, that is, its contained values can be changed, added, or deleted. See list type below.

['red', 23], [], [(x,y) for x in range(10,30,5) for y in ("a", "b")]

tuple

A tuple is a sequence of values that is immutable (cannot be modified). See tuple type below.

('red', 23), (), ("singleton",)

None

None is a special, unique value that may be used as a placeholder where a value is expected but there is no obvious value. For example, None is the value returned by functions if they don't return a specific value.

None