1.类中初始化变量
class dig():
def __init__(self,x,y):
self.x=x
self.y=y
def pd(self,r):
s=self.x+self.y+z+r #self.z=self.x+self.y+self.r AttributeError: dig instance has no attribute 'r'
f=self.x+self.y+y+r #NameError: global name 'y' is not defined print s
print f
pdc=dig(1,3)
pdc.pd