ValueError: too many values to unpack in python

technical talkiess
0

Error :-  

Traceback (most recent call last):

  File "<string>", line 25, in <module>

  File "<string>", line 16, in function_test

ValueError: too many values to unpack (expected 2)


If you iterate the dictonary but missing items :- 

error code :- 


 for key,value in dictionary_test1:

        print(f"{key} is and value {value}")


solution code:- 


 for key,value in dictionary_test1.items():

        print(f"{key} is and value {value}")



Simply add the items() function in the last of the dictionary.

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)