I am using python and i want to delete some characters from the en开发者_如何学Pythond of a text file. The file is big a and i dont want to read all of it and duplicate the interesting part. My best guess is that i need to change the file size....
can anyone help me please thanks
I guess that you need to open the file, seek to the end, delete characters and save it.
seek ( http://docs.python.org/library/stdtypes.html#file.seek ) accepts negative values (e.g. f.seek(-3, os.SEEK_END)
sets the position to the third to last), so that you can easily go to the end of your file.
http://docs.python.org/library/stdtypes.html#file-objects - this link may be a good starting point.
精彩评论