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 
    a, b, c, d = 20, 5,5, True, 4+3j
ValueError: too many values to unpack (expected 4)

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

你可能感兴趣的:(#,Python常见问题,too,many,values,to,unpack,Python)