[Tutor] clipping file to size ?

dave selby dave6502 at googlemail.com
Mon Jun 9 15:04:57 CEST 2008

Hi All,

I need to read parse and re-write the parsed file. I am opening with

f = open(file_rc, 'r+')

reading file ....


resetting file pointer ...

print >> f, section

writing smaller file...

and I end up with the remnants of the old larger file at the end.
any idea how to clip the file to the newer smaller size without
closing it and reopening it as a 'w' ?




Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

More information about the Tutor mailing list