Marc 'BlackJack' Rintsch wrote: > On Thu, 27 Sep 2007 12:36:58 -0400, Shawn Minisall wrote: > > >> With the multiple value lines, python says this "ValueError: too many >> values to unpack" >> >> I've googled it and it says that happens when you have too few or too >> many strings that don't match with the variables in number your trying >> to assign them too. Below are the lines in reading in: >> >> line 3 - 19.18 29.15 78.75 212.10 >> line 4 - 100 20 410.29 >> >> And this is the code I'm using: >> >> #read withdrawls from file on line3 >> line = infile.readline() >> >> #split withdrawls up >> withdraw1, withdraw2, withdraw3, withdraw4 = string.split(line, "\t") >> >> #read deposits from file on line4 >> line = infile.readline() >> #split deposits up >> deposit1, deposit2, deposit3 = string.split(line, "\t") >> >> I have 4 strings to match line 3 and 3 to match the 3 on line 4...any >> thoughts? >> > > First thought is to find out which of the two lines triggers the > exception. This information is part of the full traceback. > > Ciao, > Marc 'BlackJack' Rintsch >
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 -- http://mail.python.org/mailman/listinfo/python-list