Basic Python
vars
Naranjito
2022. 8. 25. 17:04
- vars
Return thd dictionary attribute.
class Person:
name = "John"
age = 36
country = "norway"
x = vars(Person)
print(x)
>>>
{'__module__': '__main__', 'name': 'John', 'age': 36, 'country': 'norway', '__dict__': <attribute '__dict__' of 'Person' objects>, '__weakref__': <attribute '__weakref__' of 'Person' objects>, '__doc__': None}