python - Programmatic way to list object properties and their values? -
I'm still relatively new to Python, so let me evict me that I'm missing something fundamental. / P>
In the interest of easy debugging, I have used the habit of making show () process for each item. For example:
class yourMom: def __init __ (manually ): Self.name = "" self.children = [] #Enit () Show DEF (self): Print "The name is '% s'"% (self.name) Print " Age for "% s" "% (self.age): For Children: Print" Children: '% s' "% (i) #and Show () #andMOM Class
So my question is simple: do you need to write manually every time? No show () No Programmatik way to process?
Edit: There is a similar question: But I am looking for values in the list of objects with their properties.
Yes, this is called a dragon bilton function
Comments
Post a Comment