匿名函数的用处

infors.sort(key= lambda x:x['age'])  按照列表中的键age排序

 

def test(a,b,func):
    rsult = func(a,b)
    print(result)

test(11,22,lambda x,y:x+y)

  eval() 去掉字符串

posted @ 2018-08-16 16:23  zmwzmw  阅读(85)  评论(0)    收藏  举报