之前在网上找相关的资料,给出的方法都不合适,

经过很长时间的试错才知道源于python2.X和python3.X的不同,

原理都是采用map函数,但是二者返回的信息不同

Python2.x,可以使用map函数

1
numbers = map(int, numbers)

如果是3.x,map返回的是map对象,当然也可以转换为List:

1
numbers = list(map(int, numbers))

所以这里需要区别对待;

链接:http://www.jb51.net/article/86561.htm

相关文章:

  • 2021-11-22
  • 2022-02-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2022-02-08
  • 2022-12-23
猜你喜欢
  • 2021-12-10
  • 2022-12-23
  • 2022-02-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-18
相关资源
相似解决方案