Python: globals() function
globals() function
The globals() function returns a dictionary representing the current global symbol table.
Version
(Python 3.2.5)
Syntax:
globals()
Parameters:
No parameters.
Example: Python globals() function
globals()
Output:
{'__cached__': None, '__builtins__': <module 'builtins' (built-in)>, '__package__': None, '__name__': '__main__', '__file__': '/tmp/sessions/33e5bf74fcdfcd2c/main.py', '__spec__': None, '__loader__': <_frozen_importlib_external.SourceFileLoader object at 0x7f465fd5e3c8>, '__doc__': None}
Python Code Editor:
Previous: getattr()
Next: hash()
Test your Python skills with w3resource's quiz
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics