May 25th, 2004, 11:42 PM
Another solusion, a mix of the too aproches really.
lines = file('file.txt', 'r').readlines()
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
programming language development: www.netytan.com – Hula
Last edited by netytan : May 25th, 2004 at 11:47 PM.