天天看點

ValueError: too many values to unpack (expected 4)

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了,這造成了變量的數目不夠,才會出現這種錯誤