how to get function names from the file

luis.armendariz at gmail.com luis.armendariz at gmail.com
Wed Feb 15 17:08:04 EST 2006


Try the following:

def printFoo():
    print "Foo"

def printFOO():
    print "FOO"

functions = ("printFoo", "printFOO")    # list or tuple of strings from
file, or wherever
for function in functions:
    call = function + "()"
    eval(call)




More information about the Python-list mailing list