On Apr 26, 6:08 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > def f1(): > > print "In f1" > > > def f3(): > > print "In f3" > > > def others(): > > print "In others" > > > for i in xrange(1,3): > > fct = "f%d()"%(i+1) > > try: > > exec fct > > except: > > others() > > I'd write that as > > for i in xrange(1,3): > globals().get("f%d" % (i+1), others)() > > Regards, > Martin
Perfect. Works great. No EXEC. You guys are great. -- http://mail.python.org/mailman/listinfo/python-list