A command in a String ?

Tim Daneliuk tundra at tundraware.com
Wed Apr 13 04:37:33 EDT 2005


Peter Moscatt wrote:
> I have a rather odd question:
> 
> Is there a way Python can execute a command within a string ?
> 
> For example if I had something like:
> _str = "fm=OptionMenu(root,xx,'string1','string2','string3')"
> 
> And the execute _str.
> 
> The reason why I am trying to do this that as I am aware the OptionMenu
> hasn't the ability insert options therefore the options would be inserted
> by manipulating strings.
> 
> Pete
> 

Look into the "eval" operation ...

-- 
----------------------------------------------------------------------------
Tim Daneliuk     tundra at tundraware.com
PGP Key:         http://www.tundraware.com/PGP/



More information about the Python-list mailing list