On Mon, Feb 16, 2009 at 11:58 AM, Wayne Watson <sierra_mtnv...@sbcglobal.net
> wrote:

>  Python doesn't like the code in the Subject (unqualified exec not allowed
> in function). but easily likes self.abc="22". However, I'd like to assemble
> the assignment as a string, as shown in Subject, and execute it. Is there a
> way to do this?
> --
>
> varName = "abc"
varValue = 22
setattr(self, varName, varValue)


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

Reply via email to