python"># class Critter(object): '''A virtual pet''' def __init__(self): print 'A new critter has been born!' def talk(self): print '\nHi. I'm an instance of class Critter.' # main crit1 = Critter() crit2 = Critter() crit1.talk() crit2.talk()
python构造函数示例
最后更新 2018-05-17 08:00 星期四 所属:
Python教程 浏览:896