case:
. 1 class Chinese: # class is created, the class name of the first letter capitalized 2 Eye = ' Black ' # class attributes created . 3 . 4 DEF the __init__ (Self, Hometown): # initialization method in the class . 5 self.hometown = Hometown # Instance Properties create 6 Print ( ' program update ...... ' ) # initialization statements 7 8 DEF born (Self): # create an instance method of 9 Print ( ' I was born in S%. ' % (self.hometown)) # 方法的具体语句 10 11 xiaofeng = Chinese('福建') # 类的实例化 12 print(xiaofeng.eye) # 打印实例的属性(从类传递的) 13 xiaofeng.born() # 实例方法的调用