deleting lines from a file

Ok, I did a search and can't seem to find the exact solution to my problem. In windows, I'm trying to delete specific lines from some files. The line number is static. I can get linecache to display the correct line, but I can't seem to figure out how to delete that line.

I found some code that supposedly deletes the last line of a file. I figured I could tweak that code and use it but it doesn't work for me.

But that doesn't really work. I know I'm missing the part where I write the file again and the del lines should be removing lines 10 through 13, but I'm not confident that I wrote that correctly either.

Just replace the bold bit with the line number you want to delete - remembering that lists/arrays start with 0 and watch that anoying line go bye bye. But your example should work all you have to do is write the data out with writelines()

The draw back being that this aproch reads the whole file into memory but then Python programs do that every day so don't worry about it .