TypeError: __init__() takes exactly 1 argument (3 given) pyXML

后端 未结 2 2047
没有蜡笔的小新
没有蜡笔的小新 2021-01-19 19:48

I\'ve recently started to learn how to use python to parse xml files. I took the tutorial from http://pyxml.sourceforge.net/topics/howto/node12.html

When I run the f

相关标签:
2条回答
  • 2021-01-19 20:09

    You've got too many _ in the name of __init__. The declaration of your constructor should be:

    def __init__(self, title, number):
    

    not:

    def __init___(self, title, number):
    
    0 讨论(0)
  • 2021-01-19 20:10

    You have a typo - there's 3 underscores here:

    def __init___(self, title, number):
    

    Should be:

    def __init__(self, title, number):
    

    Because it doesn't exactly match the name __init__, Python only knows about the default constructor, def __init__(self).

    0 讨论(0)
提交回复
热议问题