Create attribute from string

Chris Rebert clp2 at rebertia.com
Thu Dec 31 01:50:38 EST 2009


On Wed, Dec 30, 2009 at 9:22 PM, AON LAZIO <aonlazio at gmail.com> wrote:
> Hi,
>     I would like to know how we could create attribute from string
>
> say I want to assign value 0.05 to an object attribute
>
> I like to input "SIGNIFICANT" and 0.05 and get
> object.SIGFICANT equals to 0.05

setattr(obj, "SIGNIFICANT", 0.05)

Cheers,
Chris
--
http://blog.rebertia.com



More information about the Python-list mailing list