摘要: 匿名函数 -基本语法结构: lambda x : x+1 x:形参 x+1 返回值 例如:以下函数相当于lambda x : x+1 def calc (x): return x +1 res = calc(10) print(res) 将函数用匿名函数表示 def change_name(): r 阅读全文
posted @ 2021-03-07 12:50 wode110 阅读(50) 评论(0) 推荐(0) 编辑
摘要: 作用域 注意:函数,模块,类都有自己的作用域 for循环,while循环,if,else 都没有自己的作用域 def test1(): print("in the test1")def test(): print("in the test") return test1 》test1 是函数test1 阅读全文
posted @ 2021-03-07 10:14 wode110 阅读(65) 评论(0) 推荐(0) 编辑