python-嵌套函数

                            python-嵌套函数

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


打印结果
int the outside
in the inside

 

 
posted @ 2019-12-08 02:03  科子  阅读(247)  评论(0编辑  收藏  举报