Skip to content

This Repository is a collection of different ethical hacking tools and malware's for penetration testing and research purpose written in python, ruby, rust, c++, go and c.

1.2 KB
Raw Blame

title: Python locals() built-in function - Python Cheatsheet description: Update and return a dictionary representing the current local symbol table. Free variables are returned by locals() when it is called in function blocks, but not in class blocks. Note that at the module level, locals() and globals() are the same dictionary.

Python locals() built-in function From the Python 3 documentation Update and return a dictionary representing the current local symbol table. Free variables are returned by locals() when it is called in function blocks, but not in class blocks. Note that at the module level, locals() and globals() are the same dictionary.

Example

def my_function():
    name = "Jim"
    age = 35
    print(locals())

my_function() # {'name': 'Jim', 'age': 35}