JAVA网络爬虫
HttpClient

导航

 

python作用域相关操作

  • LEGB

    #LEGB <===>locals(当前所在的命名空间(如函数.模块))-->enclosing(外部嵌套函数的命名空间(闭包中常见))-->
    # global(全局变量)-->builtins(内建(python默认导入的一些功能))
    
    num = 100
    def test1():
        num = 200
        def test2():
            num = 300
            print(num)
        return test2
    
    res = test1()
    res()
    
    # 运行结果
    300
    
posted on 2019-08-27 14:20  gmlgxx  阅读(32)  评论(0)    收藏  举报