如何使用类

ClassLLuffyStudent:

      school='luffycity' #数据属性

      def learn(self):    #函数属性

        print('is learning')

 

      def eat(self):  #函数属性

        print('is eating')

#查看类的名称空间

print(LuffyStudent._dict_)

print(LuffyStudent._dict_['school'])

print(LuffyStudent._dict_['learn'])

#查

print(LuffyStudent.school])

print(LuffyStudent.learn)

#增

LuffyStudent.county= 'china'

#删

del LuffyStudent.county= 'china'

#改

LuffyStudent.county= 'CHINA'

  

posted on 2019-08-05 09:27  kingforn  阅读(149)  评论(0编辑  收藏  举报