Python024闭包

闭包

1
2
3
4
5
6
7
8
9
10
11
12
13
def test(number):
# 内部函数调用访问number
def test_in():
print(number)
# 将内部函数返回
return test_in


xxx = test(100)
print("-"*30)
xxx(1)
xxx(100)
xxx(200)