Python Func Vars
# Python2.x Python vars() Function
[ Python Built-in Functions](#)
* * *
## Description
The **vars()** function returns a dictionary object containing the attributes and attribute values of an object.
## Syntax
vars() function syntax:
vars()
## Parameters
* object -- object
## Return Value
Returns a dictionary object containing the attributes and attribute values of the object. If no arguments are provided, it prints the attributes and attribute values at the current call location, similar to locals().
## Example
The following example demonstrates the usage of vars():
>>>print(vars()) {' __builtins__ ': , ' __name__ ': ' __main__ ', ' __doc__ ': None, ' __package__ ': None} >>>class Tutorial: ... a = 1 ... >>>print(vars(Tutorial)) {'a': 1, ' __module__ ': ' __main__ ', ' __doc__ ': None} >>>tutorial = Tutorial()>>>print(vars(tutorial)) {}
[ Python Built-in Functions](#)
YouTip