python字符串与数字类型转化

数字转字符串:str(数字),如str(10)

相反:int(字符串),如int('10')

另外,import string后

用string.atoi('100',base),转换为int,base为进制,默认为10。

string.atof('100',base),转换为float

string.atol('100',base),转为long

原文地址:https://www.cnblogs.com/cl1024cl/p/6205657.html