Python locals() FunctionThe python locals() method updates and returns the dictionary of the current local symbol table. A Symbol table is defined as a data structure which contains all the necessary information about the program. It includes variable names, methods, classes etc. SignatureParametersIt does not contain any parameters. ReturnIt returns the dictionary of the current local symbol table. Python locals() Function Example 1The below example shows the working of locals() inside a local scope. Output: localsAbsent: {} localsPresent: {'present': True} Explanation: The above example updates and returns the dictionary of the current local symbol table. Python locals() Function Example 2The below example shows how to update locals() dictionary values. Output: True True Next TopicPython Functions |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India