2008/12/16 xkrja <[email protected]>:
>
> Hi,
> I'm just starting out learning IronPython. How can I convert a string that
> someone writes in a textbox to a python expression or statement?? Compare it
> to the console input: If I write for example a=2 in the console it's not
> just a string I assume? It becomes an expression in the python code or
> something like that
If I understood well, you're looking for eval() function. You use it this way:
eval("1 + 4") # => 5
In your case:
root.message.Text = eval(root.message.Text)
eval() is one of the built-in python functions. You can read about
rest of them on
http://www.python.org/doc/2.5.2/lib/built-in-funcs.html
hope that answers your question.
Konrad
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com