Re: [Tutor] Better Search and replace method

2005-03-02 Thread Kent Johnson
Ron Nixon wrote: I'm trying to figure out a better solution to do multiple search and replaces in a text file without having to type: import re s = open('filename') re.sub('vaule1','value2',s) re.sub('vaule3','value4',s) etc I've tried putting all the vaules in a list and doing the replace, but c

Re: [Tutor] Better Search and replace method

2005-03-02 Thread Alan Gauld
> I'm trying to figure out a better solution to do > multiple search and replaces in a text file without > having to type: > import re > s = open('filename') s = open(...).read() # I assume? > re.sub('vaule1','value2',s) > re.sub('vaule3','value4',s) > I've tried putting all the vaules in a li

[Tutor] Better Search and replace method

2005-03-02 Thread Ron Nixon
I'm trying to figure out a better solution to do multiple search and replaces in a text file without having to type: import re s = open('filename') re.sub('vaule1','value2',s) re.sub('vaule3','value4',s) etc I've tried putting all the vaules in a list and doing the replace, but came up short. An