码迷,mamicode.com
首页 > 编程语言 > 详细

Python内置函数(26)——globals

时间:2016-10-29 12:00:48      阅读:229      评论:0      收藏:0      [点我收藏+]

标签:bsp   uil   log   function   全局变量   define   current   led   ret   

英文文档:

globals()
Return a dictionary representing the current global symbol table. This is always the dictionary of the current module (inside a function or method, this is the module where it is defined, not the module from which it is called).
说明:
  1. 返回当前作用域内全局变量的字典。
>>> globals()
{‘__spec__‘: None, ‘__package__‘: None, ‘__builtins__‘: <module ‘builtins‘ (built-in)>, ‘__name__‘: ‘__main__‘, ‘__doc__‘: None, ‘__loader__‘: <class ‘_frozen_importlib.BuiltinImporter‘>}
>>> a = 1
>>> globals() #多了一个a
{‘__spec__‘: None, ‘__package__‘: None, ‘__builtins__‘: <module ‘builtins‘ (built-in)>, ‘a‘: 1, ‘__name__‘: ‘__main__‘, ‘__doc__‘: None, ‘__loader__‘: <class ‘_frozen_importlib.BuiltinImporter‘>}

 

Python内置函数(26)——globals

标签:bsp   uil   log   function   全局变量   define   current   led   ret   

原文地址:http://www.cnblogs.com/sesshoumaru/p/6009643.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!