Re: a question from a newcomer to this language

2005-06-10 Thread Steve Horsley
Michael Chermside wrote: > Shankar writes: > >>Is there any way to convert a string into an instruction that will be >>executed? > > > Short answer: > Yes. The exec statement does what you want: > > x = 3 y = 4 exec "z = x * y" print z > > 12 > Ooh! I didn't know that on

Re: RE: a question from a newcomer to this language

2005-06-10 Thread Shankar Iyer ([EMAIL PROTECTED])
Thank you for your help. I will post the problem in more detail if I find that I cannot avoid using exec. Shankar - Original Message - From: Michael Chermside <[EMAIL PROTECTED]> Date: Friday, June 10, 2005 3:49 pm Subject: RE: a question from a newcomer to this language >

RE: a question from a newcomer to this language

2005-06-10 Thread Michael Chermside
Shankar writes: > Is there any way to convert a string into an instruction that will be > executed? Short answer: Yes. The exec statement does what you want: >>> x = 3 >>> y = 4 >>> exec "z = x * y" >>> print z 12 HOWEVER... the long answer is that you almost certainly do NOT want to use exe

a question from a newcomer to this language

2005-06-10 Thread Shankar Iyer ([EMAIL PROTECTED])
Hi, I am a undergraduate physics student, and I have been asked to write some code in Python for my summer job. Over the past few days, I have been learning Python and Tkinter, so naturally, I have several questions about the language. Here's one: Is there any way to convert a string into an