How to get type of object's attribute in python -
assume have following class:
class myclass(): def __init__(self, number): self.mystr = "bla" self.myint = number * 3
how the attributes types? mean want following list: ['str','int']?
i want work on derived classes.
thanks lot :)
use type() function. can use print out variable type this:
print(type(variable_name))
Comments
Post a Comment