TypeError:method()接受一个位置参数,但给出了2个
class MyClass: def method(arg): print(arg)
my_object = MyClass()
method("foo")
>>> my_object.method("foo")Traceback (most recent call last):File "<stdin>", line 1, in <module>TypeError: method() takes exactly 1 positional argument (2 given)
翻阅古今
相关分类