list object attributes python
>>> class new_class():
... def __init__(self, number):
... self.multi = int(number) * 2
... self.str = str(number)
...
>>> a = new_class(2)
>>> a.__dict__
{'multi': 4, 'str': '2'}
>>> a.__dict__.keys()
dict_keys(['multi', 'str'])
4.5
2
rofl = NewObject()
dir(rofl) // <-- show all available attributes that object has
Thank you!
2
0
Are there any code examples left?
New code examples in category Python