def outer():
x = 1
print("outer")
def innre():
print("innre")
return innre
res = outer()
print(res)
res()
结果:outer
这个空函数的内存innre的地址
<function outer.<locals>.innre at 0x000001F33EA52D08>
innre
"""
函数内定义函数的应用场景
"""
def outer():
x = 1
print("outer")
def innre():
print("innre")
return innre
res = outer()
print(res)
res()
结果:outer
这个空函数的内存innre的地址
<function outer.<locals>.innre at 0x000001F33EA52D08>
innre
"""
函数内定义函数的应用场景
"""