Python locals() function

The locals() function in Python updates and returns a dictionary representing the current local symbol table.

Syntax

Parameter

NA

Return

This function returns the local symbol table as a dictionary or returns free variables when it is called in function blocks, but not in class blocks

Example 1

Output

Example 2

Output

Pin It on Pinterest

Share This