最近在学习Python,在学习面向对象的内容是发现,我在实例化对象的时候__init__方法没有被调用,下面是简单的测试代码:运行之后提示错误:E:\Python2.7\python2.exe E:/pycharm/Pythontest/test41.py
Traceback (most recent call last):
File "E:/pycharm/Pythontest/test41.py", line 10, in <module>
a = Test("languomao","24")
TypeError: this constructor takes no arguments
Process finished with exit code 1也就是说我自己写的__init__方法并没有被调用,实例化这个对象的时候调用了父类(object)的__init__方法(我写的那个方法左右都是两下划线的,确认无误哦),所以,到底是哪里出了问题,有没有大神帮我解答一下。。。。
添加回答
举报
0/150
提交
取消