[Tutor] Modify a string multiple times

Chad Crabtree flaxeater at yahoo.com
Tue Sep 28 19:00:57 CEST 2004


Tom Tucker wrote:

>Python 
>########
>< extra lines removed>
>line = 'python and perl are both programming languages.'
>newstring = re.sub('python','Python',line)
>newstring2 = re.sub('perl','Perl',newstring)
>print newstring2
>
Yup I think you are making this to hard.

line='python and perl are both programming languages.'
line=re.sub("python",'Python',line)
line=re.sub("perl","Perl",.line)
print line


	
		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 


More information about the Tutor mailing list