class Person(object):
def __int__(self,name,gender):
self.name = name
self.gender = gender
class Teacher(Person):
def __int__(self,name,gender,course):
super(Teacher,self).__int__(name,gender)
self.course=course
teacher=Teacher('Alice','Female','English')
print(teacher.name)
print(teacher.gender)
print(teacher.course)'''
哪位大声给解释下 粗行 为什么运行有如下错误:
Traceback (most recent call last):
File "C:\Users\ZF\Desktop\test.py", line 25, in <module>
teacher=Teacher('Alice','Female','English')
TypeError: Teacher() takes no arguments
__init__
定义函数
def __init__(self, , ):函数是写成了 def __int__(self, , ):
改写为 def __init__(self, , ):