Python locals() Function Syntax
We can access the local symbol table in Python by using locals() function.
Syntax: locals()
Parameters: This function does not takes any input parameter.
Return Type : This returns the information stored in local symbol table.
Python | locals() function
Python locals() function returns the dictionary of the current local symbol table. We use it to access the local symbol table in Python.
- Symbol table: It is a data structure created by a compiler that is used to store all information needed to execute a program.
- Local symbol Table: This symbol table stores all information needed for the local scope of the program and this information is accessed using the Python built-in function locals().