Pattern-match & Replace - help required

AT matifayaz at gmail.com
Wed Dec 19 12:01:32 CET 2012


On Wednesday, 19 December 2012 15:51:22 UTC+5, Steven D'Aprano  wrote:
> On Wed, 19 Dec 2012 02:42:26 -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.
> 
> > 
> 
> > I've this string (basically an sql statement): 
> 
> >
> 
> > stmnt = 'SELECT taxpayer.id,
> 
> >          taxpayer.enc_name,
> 
> >          taxpayer.age,
> 
> >          taxpayer.occupation
> 
> >          FROM taxpayer WHERE (taxpayer.id IS NOT NULL);'
> 
> > 
> 
> > The requirement is to replace it with this one: 
> 
> > 
> 
> > r_stmnt = 'SELECT taxpayer.id,
> 
> >            decrypt(taxpayer.enc_name),
> 
> >            taxpayer.age,
> 
> >            taxpayer.occupation
> 
> >            FROM taxpayer WHERE (taxpayer.id IS NOT NULL);'
> 
> > 
> 
> > Can somebody please help?
> 
> 
> 
> Can you do this?
> 
> 
> 
> stmnt = r_stmnt
> 
> 
> 
> That should do what you are asking.
> 
> 
> 
> If that doesn't solve your problem, you will need to explain your problem 
> 
> in more detail.
> 
> 
> 
> 
> 
> 
> 
> -- 
> 
> Steven


I just wanted to change taxpayer.enc_name in stmnt to decrypt(taxpayer.enc_name)

hope it clarifies?

thanks





More information about the Python-list mailing list