17. python 类

white Python 2018-10-20 85 次浏览 17. python 类已关闭评论
class Chinese:
    hair = 'black'
    def smart(self):
        print('Chinese are smart %s'%self)

print(Chinese.hair)

Chinese.smart('怀特')

print(Chinese.__dict__)

Chinese.__dict__['smart']('white')

 

回顶部