globals() — Easy Examples
Returns a dictionary of the current global symbol table
Basic globals() usage
Simple demonstration of the globals() built-in function.
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.
globals() with different inputs
Calling globals() with various argument types.
python
# More globals() examples print("globals() is a Python built-in function") print(f"Type: {type(globals)}")
globals() accepts different types of arguments and produces corresponding results.
Want to try these examples interactively?
Open Easy Playground