Home >>Python Built-in Functions >Python vars() Function
Python vars() function is used to return the __dic__ attribute of an given input object. This __dict__ attribute is a dictionary containing the object's changeable attributes.
Syntax:vars(object)
Parameter | Description |
---|---|
object | This parameter defines any object with a __dict__attribute. |
class Person:
name = "Jerry"
age = 21
country = "India"
x = vars(Person)
print(x)
x = vars()
print(x)