Definition
The vars() function returns the __dic__ attribute of an object.
The __dict__ attribute is a dictionary containing the object's changeable attributes.
Syntax
vars(object)
Parameters
| Parameter | Description |
|---|---|
| object | Any object with a dict__attribute |
Examples
class Car:
name = "Ford"
model = 1987
country = "USA"
myCar = vars(Car)
print(myCar)