函数作用域

def test1():
    print('in the test1')
def test():
    print('in the test')
    return test1

res=test()#先执行test()然后执行test1()输出,
print(res())#最后执行的是test1() 没有return默认值为none不加括号返回的是地址,加了括号()就不是地址执行函数。

 

posted @ 2018-04-26 19:57  未来的技术  阅读(70)  评论(0编辑  收藏  举报