markdown
class Student:
school = '一中'
def __init__(self, name, sex, age):
self.Name = name
self.Sex = sex
self.Age = age
# stu1.Name = "王二丫"
# stu1.Sex = "女"
# stu1.Age = 18
def learn(self, x):
print(" %s is learning %s" % (self.Name, x))
def running(self):
print(" %s is running" % self.Name)
def eat(self):
print("%s is eating" % self.Name)
stu1 = Student("王二丫", "女", 18)
stu2 = Student("李三炮", "男", 38)
stu3 = Student("王五", "男", 24)
print(stu1.__dict__) # {'Name': '王二丫', 'Sex': '女', 'Age': 18}
print(stu2.__dict__) # {'Name': '李三炮', 'Sex': '男', 'Age': 38}
print(stu3.__dict__) # {'Name': '王五', 'Sex': '男', 'Age': 24}