ValueError: too many values to unpack,>>>

Fredrik Lundh fredrik at pythonware.com
Thu Sep 27 14:17:00 EDT 2007


Shawn Minisall wrote:

> Sorry, it looks like it's on the fourth line with the 3 values on line 
> 4...its reading line 3 fine
> 
> Traceback (most recent call last):
>   File "<pyshell#0>", line 1, in <module>
>     main()
>   File "I:\COMPUTER PROGRAMMING CLASS\PROJECT #1\project1.py", line 33, 
> in main
>     deposit1, deposit2, deposit3 = string.split(line, "\t")
> ValueError: too many values to unpack

instead of fumbling around in the dark, try inserting a print statement 
before the offending line, so you can see what you're trying to unpack:

     print string.split(line, "\t") # see what it is
     deposit1, deposit2, deposit3 = string.split(line, "\t")

</F>




More information about the Python-list mailing list