python-嵌套函数

                            python-嵌套函数

定义:在函数体内用def定义一个函数,它的作用域只在该函数体内有效。
def outside():
    print("int the outside")
    def  inside():
         print("in the inside")
    inside()
outside()


打印结果
int the outside
in the inside
 

 

猜你喜欢

转载自www.cnblogs.com/kezi/p/12004204.html