simpleclass专题

Python:类与对象的变量[SimpleClass.py]

【异常分析】 Exception AttributeError: "'NoneType' object has no attribute 'Population'" in <bound method__del__ of <__main__.Person instance at0x00BC4D50>> ignored 在理解“类与对象的变量”时编写了下面一段程序: #coding=utf-

SimpleClass:Python之面向对象编程

#coding=utf-8#定义一个类class Person:def sayHi(self): #函数定义时必须提供参数self,调用sayHi()方法时没有任何参数print 'Hi, How are you? ', self.namedef __init__(self, name):self.name = name##1#p = Person() #创建一个对