Odd Errors

alex23 wuwei23 at gmail.com
Mon Sep 29 02:13:28 CEST 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