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

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -