python的list()函数
发布时间:2020-12-20 12:48:52 所属栏目:Python 来源:网络整理
导读:list()函数将 其它序列 转换为 列表 (就是js的数组)。 该函数 不会改变? ? 其它序列 ? ? 效果图一: ? ? 代码一: # 定义一个元组序列 tuple_one = (123, ‘ 456 ‘ , ‘ abc ‘ ) print (tuple_one,type(tuple_one)) # 转换并赋值给变量 a a = list(tuple
list()函数将其它序列转换为 列表 (就是js的数组)。 该函数不会改变? ?其它序列 ? ? 效果图一: ? ? 代码一: # 定义一个元组序列 tuple_one = (123,‘456‘,‘abc‘) print(tuple_one,type(tuple_one)) # 转换并赋值给变量 a a = list(tuple_one) # 输出 a,a的类型 print(a,type(a)) ? ? 效果图二: ? ? 代码二: list_one = [1,2,3,4,5,6,7,8,9,10] r = filter(lambda i : i > 5,list_one) print(r,type(r)) t = list(r) print(t,type(t)) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |