1、
內嵌函數的內層函數的作用域在外層函數之內,不能在外層函數外調用內層函數。
>>> def a(): ## 外層函數a(),內層函數b(). print("hello world!") def b(): print("good morning!") return b() >>> a() hello world! good morning!
>>> b() Traceback (most recent call last): File "<pyshell#336>", line 1, in <module> b() NameError: name 'b' is not defined