I would not use exec. It is a bit slow and can be unsafe.

On Sep 13, 6:18 pm, Fran <[email protected]> wrote:
> On Sep 13, 11:11 pm, Fran <[email protected]> wrote:
>
> > I want to db(query).update(fieldname=XXX) where fieldname is a
> > variable, but whatever I try (like eval(fieldname) or `fieldname`) I
> > get:
> > SyntaxError: keyword can't be an expression
> > Must be some trick I'm missing?
>
> exec("db(query).update(%s=XXX)" % fieldname)
>
> D'Oh ;)
>
> F

Reply via email to