lambda就是
匿名函数,就是没有名字的函数
举个例子
一般的函数是这样:
def f(x):
return x+1
这样使用 print f(4)
用lambda的话,写成这样:
g = lambda x : x+1
这样使用 print g(4)
相关文章
- python在一个函数中调用另一函数中的变量
- python中的map函数
- Python中的排序sorted(, key=lambda x: x[1]) 详解 用 字节的键 或 值 排序
- Python中的排除sort函数的参数key:(key=lambda x: x[1])是什么意思
- Python中的sorted(, key=lambda x: x[1])
- 第11.24节 Python 中re模块的其他函数
- 第11.22节 Python 中re模块的字符串分割器:split函数
- python中def main是什么意思_Python main函数解析
- Python中,hasattr函数的详细介绍以及使用
- python中setup函数的用法_python学习之setUp函数和tearDown函数