Call a Python file with parameters

martin z pxtl at hotmail.com
Mon Jun 9 11:10:27 EDT 2003


I've asked this before, but last time I was too vague.  So, I've got a
simpler request: I want to write and call Python files as if they were
functions.  The problem is simple: if you write a Python file with only a
def-statement, you don't get a file you can run with arguments - you get a
file that builds a function.  If you use the argc and argv syntax, you get a
file you can run with arguments, but the arguments are strings.   Basically,
I want to have a Python file that, when I compile it, I get nothing but a
function, or something I can use like a function, that I can shove a
parameter tuple into.  Instead I get a code object (no argument tuple) or a
module (containing functions).

Can anyone help?






More information about the Python-list mailing list