一、python中字符串转换成数字

(1)import string 

tt='555'

ts=string.atoi(tt)

ts即为tt转换成的数字

转换为浮点数 string.atof(tt)

(2)直接int

int(tt)即可。

二、数字转换成字符串

tt=322

tem='%d' %tt

tem即为tt转换成的字符串

 posted on 2015-01-19 17:15  zmlctt  阅读(55822)  评论(3编辑  收藏  举报