[ Web Proxy ]
URL:
Viewing: https://mofanpy.com/tutorials/python-basic/basic/class-init [Back]  [Original]

class init | Python class  init [class init ]

x AI


class init

: Huanyu Mao : : 2016-01-01

init

__init__classinitial .

c=Calculator('bad calculator',18,17,16,15),

class Calculator: name='good calculator' price=18 def __init__(self,name,price,height,width,weight): # self.name=name self.price=price self.h=height self.wi=width self.we=weight """" >>> c=Calculator('bad calculator',18,17,16,15) >>> c.name 'bad calculator' >>> c.price 18 >>> c.h 17 >>> c.wi 16 >>> c.we 15 >>> """"

, def:

def __init__(self,name,price,height=10,width=14,weight=16): code, c.wi=17c.wiwi17.

class Calculator: name='good calculator' price=18 def __init__(self,name,price,hight=10,width=14,weight=16): #, self.name=name self.price=price self.h=hight self.wi=width self.we=weight """" >>> c=Calculator('bad calculator',18) >>> c.h 10 >>> c.wi 14 >>> c.we 16 >>> c.we=17 >>> c.we 17 """"

def __init__(self,name,price,height,width,weight):


:

""

wechat [wechat]
    []

    Python

    :



    Email: mofanpy@hotmail.com

    © 2022 mofanpy.com All Rights Reserved ICP20060366


    Web Proxy Viewer  |  New URL  |  Original Page