Odd Errors

alex23 wuwei23 at gmail.com
Sun Sep 28 20:13:28 EDT 2008


The problem is with this:

>         lines = lines.append(inLine)

The append method of a list modifies the list in-place, it doesn't
return a copy of the list with the new element appended. In fact, it
returns None, which it then attaches the label 'lines' to, so the next
iteration through it tries to call None.append...

Replace the line with:

    lines.append(inLine)



More information about the Python-list mailing list