python 作用域(LEGB)

def fa(a):
    b = 200
    c = 888

    def fb(b):
        print(b)
        print(a)
        print(c)
        print(sum)

    return fb


c = 2
sum = 10000
fa(100)(555)
# python作用域:LEGB

输出:

555
100
888
10000

 

posted on 2017-09-20 13:55  靖康耻  阅读(106)  评论(0编辑  收藏  举报

导航