python中类的定义

1 # 类名首字母大写
2 class Zhongguoren:
3     # 用赋值语句,创建类的属性
4     eye = 'black'
5 
6     # 创建实例方法时,不要漏了 self
7     def eat(self):
8         print('吃饭用筷子。')

posted on 2019-12-26 09:36  Through-Target  阅读(476)  评论(0编辑  收藏  举报

导航