python中类的定义

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

原文地址:https://www.cnblogs.com/Through-Target/p/12100372.html