Files
python/pythonProject/闭包/1.py
T

10 lines
221 B
Python
Raw Normal View History

2026-05-18 16:13:55 +08:00
"""
闭包函数
函数内部调用了函数外部的局部变量,并且外部函数返回内部函数即为闭包函数
"""
def func1():
a = 1001
def func2():
2026-10-10 16:30:09 +08:00
return a
2026-05-18 16:13:55 +08:00
return func2
2026-10-09 11:29:28 +08:00
print(func1()())