类与类继承
class Person:
def __init__(self,name,age):
self.name = name
self.age = age
def PrintPersonInformation(self):
print(f"Name={self.name},Age={self.age}")
class Student(Person):
def __init__(self, name, age, score):
super().__init__(name,age)
self.score = score
def PrintStudentInformation(self):
print(f"Name={self.name},Age={self.age},Score={self.score}")
if __name__ == "__main__":
Stu1 = Student( name="Stu1", age = 19, score = 99 )
Stu1.PrintStudentInformation()
字典
装饰器