Python 字符串 转换 整数 浮点数 数字
>>> import string
>>> string.atoi('34')
34
>>> int('34')
34
>>> string.atof('34')
34.0
>>> float('34')
34.0
>>> import string
>>> string.atoi('0x1a', 16)
26
>>> n = 0x22
>>> n
34
>>>
>>> import string
>>> string.atoi('34')
34
>>> int('34')
34
>>> string.atof('34')
34.0
>>> float('34')
34.0
>>> import string
>>> string.atoi('0x1a', 16)
26
>>> n = 0x22
>>> n
34
>>>