Python line remover
<p>Hi I have a large file that I want to delete the lines that contain the text ALL and print the file without spaces with just the remaining lines. I started a program</p>

<pre><code>sourcefile = open('C:\\scoresfinal.txt', 'r')
filename2 = open('C:\\nohet.txt', 'w')

offending = ["HET"]

def fixup( filename ): 
    fin = open( filename ) 
    fout = open( filename2 , "w") 
    for line in fin.readlines(): 
        if True in [item in line for item in offending]:
            continue
        fout.write(line)
    fin.close() 
    fout.close() 

fixup(sourcefile)
</code></pre>

<p>but it doesn't work. any help?</p>

<p>here is my error:</p>

<pre><code>Traceback (most recent call last):
  File "C:/Python Make Small File/hetcut2.py", line 18, in &lt;module&gt;
    fixup(sourcefile)
  File "C:/Python Make Small File/hetcut2.py", line 9, in fixup
    fin = open( filename )
    TypeError: coercing to Unicode: need string or buffer, file found
</code></pre>
