[Edu-sig] How to pass parameters to eval?
Titu Kim
kimtitu@yahoo.com
Wed, 26 Sep 2001 12:30:54 -0700 (PDT)
Hi,
I appreciate all replies to my previous quesions.
This time, I am trying to pass two parameter to eval
function so it can evaluate and return the result base
on the parameter i gave. For examples:
********func.py***************
def fun ():
print v1+v2
**************pro.py***********
from func import *
funname = "fun()"
v1 = "Hello "
v2 = "World"
eval(funname)
****************************
I know these code will not run. If i put fun in the
same file as pro.py, it works. What i want is to let
fun in func.py to have access to variable v1 and v2
which are declared in pro.py. How can i do this? Any
guidance or suggestion is highly appreciated.
Kim Titu
__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger. http://im.yahoo.com