a wrapper to invoke functions using argument

L

les_ander

Hi,
support I have a library of function, called mylib.py, in which
there are 2 functions 'f1' and 'f2' (1 arguments in either one);

Now I want to write a wrapper that will invoke f1 or f2 using the
command line argument. So for example, I want to write a function
"call.py" and invoke it as

python call.py f1 arg1

So this is straight forward, but I don't know how to evaluate a
function.
any help would be much appreciate it.
les
 
J

Joe Francia

Hi,
support I have a library of function, called mylib.py, in which
there are 2 functions 'f1' and 'f2' (1 arguments in either one);

Now I want to write a wrapper that will invoke f1 or f2 using the
command line argument. So for example, I want to write a function
"call.py" and invoke it as

python call.py f1 arg1

So this is straight forward, but I don't know how to evaluate a
function.
any help would be much appreciate it.
les
There is a FAQ about this:
http://www.python.org/doc/faq/programming.html#how-do-i-use-strings-to-call-functions-methods
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top