locals()

Built-in FunctionPython 2.0+Advanced

Returns a dictionary of the current local symbol table

Quick Info

Documentation
Official Docs
Python Version
2.0+

Learn by Difficulty

Quick Example

python
def example():
    a = 1
    b = 2
    print(locals())

example()

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

Try in Playground

Tags

builtinfunctioncorescopeintrospection

Related Items