ValueError: too many values to unpack (expected 4)

时间:2022-09-10 20:21:27
 
a, b, c, d = 20, 5, 5, True, 4+3j
print(type(a), type(b), type(c), type(d))
Traceback (most recent call last):
  File "/Users/paymew/Desktop/PycharmProjects/test2/example/dataType.py", line 2, in <module>
    a, b, c, d = 20, 5,5, True, 4+3j
ValueError: too many values to unpack (expected 4)

出现这种问题的原因是在最上面赋值的时候,我不小心把5.5写成5,5了,这造成了变量的数目不够,才会出现这种错误