```类与实例
## 定义了一个people类
## 其实self,就是实例本身!你实例化时python会自动把这个实例本身通过self参数传进去。
![](https://s1.51cto.com/images/blog/201810/02/0110320415a30479c1964283801ebadb.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
class people(object):

    def __init__(self,name): #构造函数 构造方法==初始化方法
        self.name=name #这是此类的成员属性

    def saysome(self): #类的方法
        print("what are you doing now ?",self.name)

    def eat(self,food,many):
        print("%s say:the %s is very nice!%s"%(self.name,food,many))

p1=people('王宇')#实例化后的对象叫 实例!!
p2=people('宁程')

p1.saysome()#执行
p2.saysome()
p1.eat('root',"att")``