摘要: 1 a = 2 2 def b(): 3 a = 3 4 print id(a) 5 class c(): 6 def __init__(self): 7 print id(c) 8 d =c() 9 print id(d) 10 print d 阅读全文
posted @ 2017-05-13 16:22 扫驴 阅读(315) 评论(0) 推荐(0)
摘要: 1 class a(): 2 name="11"#类变量 3 global name1#类中的全局变量 4 name1 = "22" 5 def __init__(self): 6 print self.name #实例可以访问类变量 7 self.name = "33" 8 def do(sel... 阅读全文
posted @ 2017-05-13 15:29 扫驴 阅读(236) 评论(3) 推荐(0)