On Wednesday, 19 December 2012 16:27:19 UTC+5, Thomas Bach wrote: > On Wed, Dec 19, 2012 at 02:42:26AM -0800, AT wrote: > > > Hi, > > > > > > I am new to python and web2py framework. Need urgent help to match a > > > pattern in an string and replace the matched text. > > > > > > > Well, what about str.replace then? > > > > >>> 'egg, ham, tomato'.replace('ham', 'spam, ham, spam') > > 'egg, spam, ham, spam, tomato' > > > > > > If the pattern you want to match is more complicated, have a look at > > the re module! > > > > Regards, > > Thomas.
The pattern is '%s.enc_%s', and after matching this pattern want to change it to 'decrypt(%s.enc_%s)' Thanks -- http://mail.python.org/mailman/listinfo/python-list