python 入坑路--装饰器(语法糖)前戏2
嵌套函数
定义:在一个函数体内,用def 定义另一个函数体,
如下例子是 嵌套函数 def test1(): print("in the test1") def teest2(): print("in the test2") 以下例子是 函数中引用了其它函数,需要注意区别 def test2(): print("in the test2") def test1(): print("in the test1") test2()
再次回顾局部变量及全局变量
如下打印结果 x=4, 局部变量会从内而外去找。


浙公网安备 33010602011771号