函数式编程补充

people=[
    {'name':'alex','age':100},
    {'name':'tom','age':10},

]
print(list(filter(lambda p:p['age']<18,people)))

[{'age': 10, 'name': 'tom'}]

猜你喜欢

转载自www.cnblogs.com/wfl9310/p/8964419.html