I want to edit an Apache2 config file within a python script. I want to add or remove a domain name to the ServerAlias directive so the script needs to edit a specific file and search for a line that starts with "ServerAlias" and append or remove a specific domain name to that line.
I'm not sure how to do it, any hint at documentation would be appreciated, I am also considering using a subprocess to use some bash tools like sed.