发表于: 2018-01-09 00:36:07

1 856


今天完成的事:

学习map函数

示例:

 def test(x):

       return x+1

这个函数可以用匿名函数代替:

 lambda x:x+1

 python3版本:

 l=[1,2,3]

 list(map(test,l))

#[2,3,4]

等价于:list(map(lambda x:x+1,l)) 




返回列表 返回列表
评论

    分享到