类的实例化参数问题

class DemoInit: def __init__(self,x,y=0): self.x=x self.y=y def mycal(self): return self.x+self.y dia=DemoInit(3) print('调用mycal方法的结果1:') print(dia.mycal()) dib=DemoInit(3,7) print('调用myc
相关文章
相关标签/搜索