problems when unpacking tuple ...
harold
dadapapa at googlemail.com
Sat Apr 22 12:21:40 EDT 2006
Dear all,
Maybe I stared on the monitor for too long, because I cannot find the
bug ...
My script "transition_filter.py" starts with the following lines:
import sys
for line in sys.stdin :
try :
for a,b,c,d in line.split() :
pass
except ValueError , err :
print line.split()
raise err
The output (when given the data I want to parse) is:
['0.0','1','0.04','0']
Traceback (most recent call last):
File "transition_filter.py", line 10, in ?
raise err
ValueError: need more than 3 values to unpack
What is going wrong here? Why does python think that
I want to unpack the outcome of line.split() into three
values instead of four? I must be really tired, but I just
cannot see the problem. Any clues??
Thanks,
- harold -
More information about the Python-list
mailing list