#!/usr/local/bin/python3
# -*- coding:utf-8 -*-
# 函数嵌套
def func_out():
num1 = 10
def func_inner(num2):
# 内部函数
# 调用外部函数变量
result = num1 + num2
print(result)
# 外部函数返回内部函数
return func_inner
# 获取闭包对象
# 这个new_func就是闭包 new_func = func_inner
new_func = func_out()
# 执行闭包
new_func(1)
new_func(20)