Hi guys, how would you do a clever find and replace, where the value replacing the tag is changing on each occurence ?
".......TAG............TAG................TAG..........TAG....." is replaced by this : ".......REPL01............REPL02................REPL03..........REPL04..." A better and clever method than this snippet should exist I hope : counter = 1 while 'TAG' in mystring: mystring=mystring.replace('TAG', 'REPL'+str(counter), 1) counter+=1 ... (the find is always re-starting at the string beginning, this is not efficient. any ideas ? thanks, Olivier -- http://mail.python.org/mailman/listinfo/python-list