2021年2月10日星期三

Trying to assign values from tuple to variables, "Too many values to unpack (expected 4)"

I started learning Python, and I'm working on input/output subject and I got this error:

  File "c:\Users\never\Desktop\Projects with IT\__pycache__\writing.py", line 30, in <module>      title, artist, year, tracks = imelda  ValueError: too many values to unpack (expected 4)  

And this is my code:

imelda = ('mother may', 'Imelda May', '2011', (1, 'Pulling the Rug'), (2, 'Psycho'), (3, 'Amine'))        print(imelda)  title, artist, year, tracks = imelda  print(title)  print(artist)  print(year)     
https://stackoverflow.com/questions/66147624/trying-to-assign-values-from-tuple-to-variables-too-many-values-to-unpack-exp February 11, 2021 at 09:41AM

没有评论:

发表评论