我完全不知道为什么我会收到错误
Traceback (most recent call last):
File ".../minimal.py", line 8, in <module>
obj = Clazz([0], [[0], [0]], [[0]])
File ".../minimal.py", line 5, in __init__
self.c = c
AttributeError: 'list' object has no attribute 'c'
从下面的一段代码
class Clazz(object):
def __init__(self, a, b, c):
self.a = a
self,b = b
self.c = c
if __name__ == "__main__":
obj = Clazz([0], [[0], [0]], [0])
当我只通过
obj = Clazz([0], [0], [0])
我收到以下错误:
Traceback (most recent call last):
File ".../minimal.py", line 8, in <module>
obj = Clazz([0], [[0], [0]], [0])
File ".../minimal.py", line 4, in __init__
self,b = b
ValueError: need more than 1 value to unpack
我试图用谷歌搜索,但没有类似的问题。怎么会这样?这些错误的原因是什么?