2016年4月26日

python类

摘要: 一般来说,实例变量用于对每一个实例都是唯一的数据,类变量用于类的所有实例共享的属性和方法: 1 class Dog(object): 2 kind = 'canine' #类变量用于类的所有实例共享的变量 3 def __init__(self,name): 4 self.name = name # 阅读全文

posted @ 2016-04-26 14:34 guoqp 阅读(224) 评论(0) 推荐(0)

导航