Python中报错提示:TypeError: Student() takes no arguments

Traceback (most recent call last):
  File "E:/learnpython/day06/15.py", line 20, in
    tom = Student ("aaszsdf",'adfsgfd')

TypeError: Student() takes no arguments

 

 

检查你的   def __init__(self,   ,  ):函数是不是写成了   def __int__(self,   ,   ):

如果是那么改写为   def __init__(self,   ,   ):就可以了

 

ps:评论区还有很好的解法,可以看一下!

 

下面是小编制作的一个微信小程序,感兴趣的可以看一下!

你可能感兴趣的:(Python中报错提示:TypeError: Student() takes no arguments)