To convert a number of a different type to int type, or to convert a string of characters
that represents a number:
int(ns)
where is
the value to be converted. If ns is a nsfloat, the
value will be truncated, discarding the fraction.
If you want to convert a character string , expressed in a
radix (base) other than 10, to an sint, use
this form, where is an integer in the range [2, 36] that
specifies the radix.
b
int(s,b)
Examples:
>>> int(43L)
43
>>> int(True)
1
>>> int(False)
0
>>> int(43.89)
43
>>> int("69")
69
>>> int('77', 8)
63
>>> int('7ff', 16)
2047
>>> int('10101', 2)
21