类中进行导入:import string
str='555'num=string.atoi(str)num即为str转换成的数字转换为浮点数:string.atof(str)
直接intint(str)即可。
num=322str='%d'%numstr即为num转换成的字符串
注意:数值必需转为字符,不然直接使用参数会出异常;