| 12345678910111213141516171819202122 |
- import sys
- class Test(object):
- def __init__(self):
- self._msg = "haha"
-
- def msg(self):
- return self._msg
-
-
- def classe(txt):
- try:
- retour = getattr(sys.modules[__name__], txt)
- except:
- retour = None
- return retour
-
- t = "Test"
- tt = classe(t)()
- print tt.msg()
|