python中map()函数的使用 分类: python 20121220 16:18 121人阅读 评论(0) 收藏

讨论如何将列表中的元素转换为int类型:

a=【’123‘,456,’7‘】#包含两个字符串和一个数字

map(int,a) 可以使a中的字符串转换为int类型


d=['1','2',3]

把d里面的所有元素转换成int类型:d=map(int,d)

版权声明:本文为博主原创文章,未经博主允许不得转载。

原文地址:https://www.cnblogs.com/think1988/p/4628262.html