Shane Holloway (IEEE)
shane.holloway at ieee.org
Thu Aug 12 00:16:51 CEST 2004
If you want to execute python-type statements, then you will want to use
eval(). However, if your input is limited to smaller expressions, you
can parse the input into pieces and then interpret them.
So, what I'm saying is that you need to provide more information. What
subset of eval's functionality do you need?
Dag Hansteen wrote:
> I make a GUI calculator in wxPython.
> How can I do the following without having to use eval?:
> def OnCalc(self, event):
> regnestykke = self.formel.GetValue()
> svar = eval(regnestykke)
> svar = str(svar)
> self.answer.SetValue("Error! Check Syntax!")
> self.formel is defined as wxTextCtrl for the input from user to be
> self.answer is defined as wxTextCtrl for the answer of the users input
More information about the Python-list