May-09-2021, 04:42 PM
Hello
I wanted to ask whether it was possible to list all the methods associated with a Class for example:-
I have created the following class:-
My question is this: is there any Python code that allows me to enter the name of the class and the output are all the methods associated with that class?
Thank you.
I wanted to ask whether it was possible to list all the methods associated with a Class for example:-
I have created the following class:-
class Human():
def __init__(self, sex, eyecolor, height, yearborn):
self.sex = sex
self.eyecolor = eyecolor
self.height = height
self.yearborn = yearborn
print("Object", self.sex, self.eyecolor, self.height, self.yearborn, "Has been created")
def age(self):
currentdate = date.today()
a = currentdate.year - self.yearborn
return a
def display(self):
print(self.sex)
print(self.eyecolor)
print(self.height)
print(self.yearborn)
In the above class I have created I have 2 x methods age() and display().My question is this: is there any Python code that allows me to enter the name of the class and the output are all the methods associated with that class?
Thank you.
