人生与戏

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

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))

 

posted on 2019-08-03 23:02  人生与戏  阅读(8131)  评论(0编辑  收藏  举报