w3resource

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



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/python/built-in-function/globals.php