vars()
Anonymous contributor
Anonymous contributor1 total contribution
Anonymous contributor
Published Jun 22, 2023
Contribute to Docs
vars()
is a built-in Python function that returns the __dict__
attribute of an object. The __dict__
attribute is a dictionary containing the object’s mutable attributes.
Syntax
vars(object)
Here, object
refers to an instance of a particular class.
Codebyte Example
The following example uses vars()
to return the __dict__
attributes of the object Person
:
All contributors
- Anonymous contributorAnonymous contributor1 total contribution
- Anonymous contributor
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.