linlu11 的博客

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
>>>

posted on 2009-12-16 22:13  linlu11  阅读(995)  评论(0编辑  收藏  举报

导航