Jerome Jabson wrote:
> Hi Kent,
> 
> Sorry I didn't make my question clearer. Bascially I
> want to replace this line:
> 
> <srm:socket portNumber="138" tcpORudp="UDP"
> address="64.41.134.60"/>
> 
> With:
> 
> <srm:socket portNumber="2" tcpORudp="TCP"
> address="64.41.134.60"/>
> 
> So the regex grouping are that I want to keep
> portNumber= and tcpORudp= and replace the values.
> Which will be varibles in my code. 
> 
> The question is more on the string formatting in the
> replace. How do use two %s in one statement? 
> 
> i.e.: re.sub('\1 %s \2 %s' % var1 % var2, line)

Ok, actually now I can reread your original question and it makes sense :-)

I think I'm having an off day for answering questions. I'm glad Alan is 
with it :-) he gave the answer you need.

Kent

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to