Python class

3.classier classes
remove the pass statement in your class definition,then go ahead and define an init__() function for your Animal class.
pass it the argument self for now.
finally,put the pass into the body vof the init() definition.since it will expect an indented block.

class Animal(object):
def init(self):
pass

init两边都是双划线,在电脑上和手机上都看不出来,在问答里面找到了这个知识点。电脑和手机上的两条下划线看起来就像一条。

2.class

create a class called Animal in the editor.for now,in the body of your class use the pass keyword.(pass doesn't do anything ,but as a placeholder in areas of your code where python expects an expression)

syntax:
class NewClass(object):

class Animal(object):
pass

你可能感兴趣的:(Python class)