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

1.数字转字符串

i = 123

str = ‘%d’ %i

str即为转换成的字符串

2.字符串转换成数字:

import string 

tt='555'

ts=string.atoi(tt)

ts即为tt转换成的数字

原文地址:https://www.cnblogs.com/XDJjy/p/4981210.html