#用lambda表达式来排序a=[{"name":"zhangsan","age":10},{"name":"lisi","age":15},{"name":"wangwu","age":6}]a.sort(key=lambda x:x[‘age‘])print(a)#func相当于一个lambda表达式func=raw_input("请输入表达式")func=eval(func)def add(a,b,func): c=func(a,b) return ccc=add(3,5,func)print(cc)
原文地址:https://www.cnblogs.com/luoliang-gaoyu/p/8405366.html
时间: 2024-10-12 16:01:35