英文文件:
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 smoded whichule ).
#說明:
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內建globals函數的詳細介紹的詳細內容。更多資訊請關注PHP中文網其他相關文章!