from:http://blog.csdn.net/thinkmore1314/article/details/9931049
类
-
class test1(object):
-
def __init__(self):
-
print "i am test1"
-
-
class test2(object):
-
def __init__(self):
-
print "i am test2"
-
-
-
class_name = 'test1'
-
eval(class_name)()
-
-
-
-
def exec_class(name):
-
name()
-
exec_class(test2)
函数
-
def show():
-
print 'I am show'
-
-
def talk():
-
print 'I am talk'
-
-
method = 'show'
-
eval(method)()
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26250550/viewspace-1283221/
,如需转载,请注明出处,否则将追究法律责任。