vars()
function is used to find the the __dict__ attribute of the given object if the object has __dict__ attribute in Python for the given input.
vars()
function is a part of Python Built-in Functions.
Syntax of vars()
Function
The syntax of
vars()
function in Python is:
vars(object)
Parameters of vars()
Function in Python
x
– Where x
is any valid . This parameter is required.
Compatibility
vars()
function is available and compatible with both Python 2.x
and 3.x
.
Return Value of vars()
Function in Python
vars()
function returns the __dict__ attribute of the given object if the object has __dict__ attribute for the given input.
Python vars()
Function Example 1
Example CODE
Output:
Python vars()
Function Example 2
Example CODE
Output: