1
我是新来的python和总编noob与编程,所以忍受。构建Python类
如果我是建筑展Person类
class Person:
def __init__ (self, Name, Address, Phone, Height, Weight):
self.name = Name
self. Address = Address
self.Phone = Phone
self.Height = Height
self.Weight = Weight
self.PoundserPerInch = int(Height)/int(Weight)
究竟是什么的__init__()
功能的代码呢?
虽然'__init __()'通常被称为“构造函数”,但它实际上并不是。它在构造实例后调用,它作为'self'参数传递。实际的构造函数是'__new __()'。 – 2012-07-14 19:25:30
@SvenMarnach:谢谢,我还不知道。这很好。 – 2012-07-14 19:26:45