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.0 KB
Raw Blame

title: Python vars() built-in function - Python Cheatsheet description: Return the dict attribute for a module, class, instance, or any other object with a dict attribute.

Python vars() built-in function From the Python 3 documentation Return the __dict__ attribute for a module, class, instance, or any other object with a __dict__ attribute.

Examples


class Person:
    def __init__(self, name, age):
        self.name = name
        self.age = age
my_person = Person("Dwight", 35)

my_vars = vars(my_person)

print(my_vars)
# {'name': 'Dwight', 'age': 35}