[Tutor] Better Search and replace method

Ron Nixon nixonron at yahoo.com
Wed Mar 2 21:54:04 CET 2005


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. Any suggestions?

Thanks in advance

Ron


	
		
__________________________________ 
Celebrate Yahoo!'s 10th Birthday! 
Yahoo! Netrospective: 100 Moments of the Web 
http://birthday.yahoo.com/netrospective/


More information about the Tutor mailing list