I can't understand re.sub

Mr Zaug matthew.herzog at gmail.com
Sun Nov 29 20:24:34 EST 2015


On Sunday, November 29, 2015 at 8:12:25 PM UTC-5, Rick Johnson wrote:
> On Sunday, November 29, 2015 at 3:37:34 PM UTC-6, Mr Zaug wrote:
> 
> > The items I'm searching for are few and they do not change. They are "CONTENT_PATH", "ENV" and "NNN". These appear on a few lines in a template file. They do not appear together on any line and they only appear once on each line. This should be simple, right?
> 
> Yes. In fact so simple that string methods and a "for loop" will suffice. Using regexps for this tasks would be like using a dump truck to haul a teaspoon of salt.

I rarely get a chance to do any scripting so yeah, I stink at it.

Ideally I would have a script that will spit out a config file such as 087_pre-prod_snakeoil_farm.any and not need to manually rename said output file.



More information about the Python-list mailing list