Python老男孩 day16 函数(六) 匿名函数
生活随笔
收集整理的這篇文章主要介紹了
Python老男孩 day16 函数(六) 匿名函数
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?
https://www.cnblogs.com/linhaifeng/articles/6113086.html?
——————————————————————————————————————
?
九、匿名函數
def calc(x):return x+1res=calc(10) print(res) #輸出1 print(calc) #輸出2print(lambda x:x+1) #輸出3 func=lambda x:x+1 print(func(10)) #輸出4運行結果:
11
<function calc at 0x0000000002311D08>
<function <lambda> at 0x0000000002311C80>
11
運行結果:
alex_sb
運行結果:
匿名函數的運行結果 alex_sb
運行結果:
6
轉載于:https://www.cnblogs.com/zhuhemin/p/9110685.html
總結
以上是生活随笔為你收集整理的Python老男孩 day16 函数(六) 匿名函数的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如何查看信用卡是什么时候办理的
- 下一篇: 撞出租车误工费保险公司赔吗