{"id":24883,"date":"2021-11-10T09:36:01","date_gmt":"2021-11-10T04:06:01","guid":{"rendered":"https:\/\/python-programs.com\/?p=24883"},"modified":"2021-11-10T09:36:01","modified_gmt":"2021-11-10T04:06:01","slug":"python-vars-function-with-examples","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-vars-function-with-examples\/","title":{"rendered":"Python vars() Function with Examples"},"content":{"rendered":"

vars() Function in Python:<\/strong><\/p>\n

The vars() function returns an object’s __dict__ attribute.<\/p>\n

The __dict__ attribute is a dictionary that contains a list of the object’s changeable attributes.<\/p>\n

Note:<\/strong><\/p>\n

It should be noted that calling the vars() function without any parameters will result in the return of a dictionary containing the local symbol table.<\/p>\n

Syntax:<\/strong><\/p>\n

vars(object)<\/pre>\n

Parameters<\/strong><\/p>\n

object:<\/strong> It may be Any object that has the __dict__ attribute.<\/p>\n

Return Value:<\/strong><\/p>\n

vars() returns the given object’s __dict__ attribute.<\/p>\n