First, traverse the properties of the object:
1.dir (obj): Returns the list of property name strings for the object, including properties and methods.
For attr in Dir (obj):
Print (attr)
2.OBJ.__DICT__: Returns the object's property name and value key-value pair or the method name and method object (which can be called) key-value pairs.
The Dir function and the __dict__ property are basically all objects (modules, classes) that can be used, and Dir () returns the parent collection returned by __dict__.
Second, get or set properties
GetAttr (obj,name)//Returns a property value or function object, and if name is the function name, it can be called by parentheses, that is, GetAttr (Obj,name) () called the function name.
SetAttr (Obj,name,value)//equivalent to Obj.name=value assignment statement
Third, iterate over the object properties and then call the function or set the value
Will
Python iterates over and gets the object properties--dir (), __dict__,getattr,setattr