Executing functions

DataSmash rdh at new.rr.com
Fri Feb 11 15:15:42 CET 2011


Can someone help me understand why Example #1 & Example #2 will run
the functions,
while Example #3 DOES NOT?
Thanks for your time!
R.D.

def One():
    print "running fuction 1"
def Two():
    print "running fuction 2"
def Three():
    print "running fuction 3"


# Example #1
fList = ["Two()","Three()"]
for func in fList:
    exec func

# Example #2
Two()
Three()

# Example #2
fList = ["Two()","Three()"]
for func in fList:
    func



More information about the Python-list mailing list