python-函数嵌套

函数嵌套就是在函数内部定义子函数

def father(name):
    print('from father %s' %name)
    def son():
        print('from son')
        def grandson():
            print('from grandson')
        grandson()
    son()

father('James')

你可能感兴趣的:(编程语言)