Python 为什么要这样印刷;无”;运行程序之后?
您正在Python 为什么要这样印刷;无”;运行程序之后?,python,Python,您正在类total_fee中调用print(super().name()),该函数通过继承树依次调用student,但此方法不返回任何结果(None) class student: def name(self): print('Aman') print('kant') class hostel_fee(student): def hfee(self): print('hostel fee',int(78000)) r
类total_fee
中调用print(super().name())
,该函数通过继承树依次调用student
,但此方法不返回任何结果(None
)
class student:
def name(self):
print('Aman')
print('kant')
class hostel_fee(student):
def hfee(self):
print('hostel fee',int(78000))
return 78000
class academic_fee(student):
def afee(self,):
print('academic fee',int(69500))
return 69500*2
class total_fee(hostel_fee,academic_fee):
def Total(self):
self.h=super().hfee()
self.a=super().afee()
self.t=self.a+self.h
print('total fee',self.t)
print(super().name())
obj=total_fee()
obj.Total()