python动态加载类和方法

1
2
3
4
5
6
7
def _importCls(self,model,action,params):
obj = __import__(model)
entrance = getattr(obj,action)
if params == '':
entrance()
else:
entrance(params)