- 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}
'Basic Python' 카테고리의 다른 글
return vs yield, yield vs yield from (0) | 2022.11.30 |
---|---|
lambda (0) | 2022.11.29 |
__new__, __init__ (0) | 2022.07.13 |
Underscore(_) (0) | 2022.07.05 |
instancemethod, classmethod, staticmethod (0) | 2022.07.01 |