student.print_score() student.say_hello() cate = Cate('bob') cate.run() cate.eat() print(dir(cate)) # def set_age(self, age): # self.age = age # student.name = "Lucy" # student.sex = '男' student.age = 90 print(student.age) print(student2.age) print(student) # print(student.name) # 动态绑定方法到实例 # student.set_age = MethodType(set_age, student) # student.set_age(20) # print(student.age) url1 = Chain().users.test print(url1) url = Chain().users('mac').photo('testphoto').repos
from Student import Student bart = Student('Bart Simpson',59) lisa = Student('Lisa Simpson',87) bart.print_score() lisa.print_score() bart.age = 18 print(bart.age) print(lisa.getGender()) lisa.setGender(100) print(lisa.getGender())