[Pythonmac-SIG] MemoryError Problem
Francois Granger
fgranger@altern.org
Thu, 26 Apr 2001 12:29:45 +0200
on 26/04/01 5:48, Richard Gordon at richard@richardgordon.net wrote:
> [...] and I'd be interested in any suggestions that you may have
> about editing files in place. Thanks.
Have a look to the module /lib/module-fileinput.html in the HTML
documentation
def strip(f):
global fcount
infh = open(f, 'rb').read()
os.rename(f, f +'~')
outfh = open(f, 'wb')
outfh.write(infh.replace('\n',''))
outfh.close()
fcount =+ 1