X-man

导航

python 字符串与数字之间的转换

1.数字转字符串

i = 123

str = ‘%d’ %i

str即为转换成的字符串

2.字符串转换成数字:

import string 

tt='555'

ts=string.atoi(tt)

ts即为tt转换成的数字

posted on 2015-11-20 16:27  雨钝风轻  阅读(1455)  评论(0编辑  收藏  举报