摘要:
#!/usr/bin/python# Filename: objvar.pyclass Person: '''Represents a person.''' population = 0 def __init__(self, name): '''Initializes the person's da 阅读全文
摘要:
#!/usr/bin/python# Filename: class_init.pyclass Person: def __init__(self, name): self.name = name def sayHi(self): print 'Hello, my name is', self.na 阅读全文
摘要:
#!/usr/bin/python# Filename: method.pyclass Person: def sayHi(self): print 'Hello, how are you?'p = Person()p.sayHi()# This short example can also be 阅读全文