81 Definition:
Class name (argument list): #
__init__ (self, Argument list): # __init__ is called a constructor, which functions: When using a class instance object, an automatic call to _init_, a function that initializes the object, assigns a value to the default value,
Self. Parameter list = parameter list # Self represents a class instance object, note that it is not a class that represents assigning a parameter list to a class instance object
def func (self, argument list) # The first argument of all class functions must be self!!
--------------Example-----------
Class girlfriend (name, age, Height,weight, cup): #类名第一个字母大写
__init__ (self, parameter list)
Self.name = Name
Self.age = Age
Self.height = height
Self.weight = Weight
Self.cup = CPU
def domasage (self, ' Tai style '). # which object invokes the method, then self in the method represents that object. Who calls the method, who is the master of the method
Print ("Do it every Day")
Mygirlfriend = girlfriend ("xxx", 170,50, ' C ') # After defining the instance Session object Mygirlfriend, Mygirlfriend automatically calls the constructor and assigns the class's parameters to the Mygirlfriend
Python class functions