Код: Выделить всё
from __future__ import with_statement
filename = "..." # or sys.argv...
with open(filename) as f:
new_txt = # ...some translation of f.read()
open(filename, 'w').write(new_txt)
Подробнее здесь: https://stackoverflow.com/questions/227 ... write-back
Мобильная версия