open file, review it, process, behind - shortest slight python
i wish simple filtering file. review it, processing, back.
i'm looking "golfing", nonetheless wish simplest many glorious slight grasp this. i came adult with:
from __future__ import with_statement
filename = "..." # sys.argv...
with open(filename) f:
new_txt = # ...some interpretation f.read()
open(filename, 'w').write(new_txt)
the with matter creates things shorter given i don't have definitely open tie file.
any ideas ?
Comments
Post a Comment