don't understand error message

Manuel Hendel manuel at hendel.net
Tue Sep 17 05:44:10 EDT 2002


On Tue, Sep 17, 2002 at 09:12:06AM +0000, Duncan Booth wrote:
> It simply means that at least one line of your file doesn't have 4 fields 
> after you have finished your processing. If the line only has two "|" 
> characters in it, then you will only get three fields which you can access 
> with indices 0 to 2. Trying to use an index out of range for a list will 
> produce this error.
> 
> Try sticking a "print fields" line just before the if statement, the last 
> line printed will show you which line didn't match.

My script already changed a little bit, I tried to fix it by my self,
but it seams, that I just moved the error. How would you check the
lines for the number of fields?
Actually, I think I found that problem. I forgot some "---|--|--" at
the end.
But I already got a new one.

[....]
if domainfield in domain:
    domainlines.append(line)
[....]

This should work if the domainfield and domain got the following
values, shouldn't it?

domainfield = 1234.ab.cdef.de
damain = 1234.ab.cdef.de

But I get this error message:

TypeError: 'in <string>' requires character as left operand

Manuel



-- 
A beautiful man is paradise for the eyes, hell for the soul, and purgatory for 
the purse.  




More information about the Python-list mailing list