globals()

Built-in FunctionPython 2.0+Advanced

Returns a dictionary of the current global symbol table

Quick Info

Documentation
Official Docs
Python Version
2.0+

Learn by Difficulty

Quick Example

python
x = 42
g = globals()
print("x" in g)
print(g["x"])

globals() is a built-in function that returns a dictionary of the current global symbol table.

Try in Playground

Tags

builtinfunctioncorescopeintrospection

Related Items