What is the easiest way in python to modify linux config file?
<p>I have some python scripts that configure linux computers. One of the tasks is to modify a configuration file for subversion. This file, <code>~/.subversion/servers</code> is very simple and looks like this:</p>

<pre><code># store-passwords = no
# store-plaintext-passwords = no
# store-ssl-client-cert-pp = no
# store-ssl-client-cert-pp-plaintext = no
... lots of other options ...
</code></pre>

<p>The task of my script is to find a required option, for example <code>store-plaintext-passwords</code> and to set it to specified value, for example <code>yes</code>. The problem is: the script can run multiple times on same machine, so if it is run first time this option can be just commented, if it is run second time it can be uncommented and set to <code>yes</code>, third run can point out that it is uncommented - but set to <code>no</code> etc. Currently i have a rather complex code that search file for the string, splits it for comment/name/value, uncomments it if needed, changes value if needed and replaces it. Maybe it's an easier way possible?</p>
