text file edit object

Batista, Facundo FBatista at uniFON.com.ar
Fri Jul 11 08:11:41 EDT 2003


#- file = TextFile( "foo.txt" )
#- del file[:-10] # remove last 10 lines
#- file.save()

myfile = open("foo.txt", "r")
mylines = myfile.readlines()[:-10]
myfile.writelines(mylines)
myfile.close()

I only see two problems with this:
	- Poor performance on very big files
	- Bad support on "hanging in the middle"


.	Facundo






More information about the Python-list mailing list