python get attributes of object
getattr(object, 'attribute_name')
python get attributes of object
getattr(object, 'attribute_name')
how to view all attributes and methods of an object python
class Person:
def __init__(self,name,age):
self.name = name
self.age = age
def printInfo(self):
print("name: {}, age: {}".format(self.name,self.age))
p1 = Person('Tom',24)
# right below
print(p1.__dict__)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us