Newbie question: string replace
aleaxit at yahoo.com
Sat Oct 29 04:56:37 CEST 2005
Mike Meyer <mwm at mired.org> wrote:
> "usgog at yahoo.com" <usgog at yahoo.com> writes:
> > So how to overwrite the config file directly in script.py instead of
> > running script.py with two params?
> Don't overwrite the file directly. Save a copy, then rename it. That
See module fileinput in the standard library, it does this for you
automatically when used in the right way -- much better than rolling
your own and having to debug it and maintain it forever!
More information about the Python-list