之前在网上找相关的资料,给出的方法都不合适,
经过很长时间的试错才知道源于python2.X和python3.X的不同,
原理都是采用map函数,但是二者返回的信息不同
Python2.x,可以使用map函数
numbers
=
map
(
int
, numbers)
如果是3.x,map返回的是map对象,当然也可以转换为List:
list
, numbers))
所以这里需要区别对待;
链接:http://www.jb51.net/article/86561.htm
python中字符串list转化为数值型
原文:http://www.cnblogs.com/haobang008/p/6718411.html