Generate config file from template using Python search and replace.
Mr Zaug
matthew.herzog at gmail.com
Sun Nov 29 21:31:28 EST 2015
On Sunday, November 29, 2015 at 5:50:51 PM UTC-5, Peter Otten wrote:
> Mr Zaug wrote:
>
> > When I run this script on OS X El Capitan, I see,
> >
> > # permission sensitive cache
> > $include "_dispatcher_shared_auth-checker:
> >
> > Was I supposed to incorporate it into the script I posted?
>
> Are you referring to my post? I'm sorry, I can't make sense of your
> question.
I seem to be heading in this direction.
#!/usr/bin/env python
import re
from os.path import exists
script, template_file = argv
print "Opening the template file..."
with open (template_file, "r") as a_string:
data=a_string.read().replace('BRAND', 'Fluxotine')
print(data)
So now the challenge is to use the read().replace magic for multiple values.
More information about the Python-list
mailing list