作用域 globals locals

globals:全局变量

locals:当前所在命名空间,

enclosing:上一层变量(闭包中常见)

builtins:内建模块的命名空间(python在启动的时候自动加载内置函数,我们可以用dir(__builtion__)来查看)



内建模块中有一个ads()函数,其功能求绝对值:ads(-20)返回20





猜你喜欢

转载自blog.csdn.net/weixin_42100915/article/details/80173085
今日推荐