> For the complete documentation index, see [llms.txt](https://nining.website/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nining.website/python/func/builtin-func/vars.md).

# vars

```python
'''
vars() 函数返回对象object的属性和属性值的字典对象
如果没有参数，就打印当前调用位置的属性和属性值 类似 locals()
'''

class Foo(object):
    key = 'value'

# {'key': 'value'}
print({key: value for (key, value) in vars(Foo).items() if not key.startswith('_')})
```
