Python vars() Function

Python vars() Function

The vars() function in Python returns the __dict__ attribute for a module, class, instance, or any other object with a __dict__ attribute.

Syntax

Parameter
object: This parameter represents any object with a __dict__attribute

Return

This function returns the __dict__ attribute.

Example 1

Output