fork(2) download
  1. class X(object):
  2.  
  3. def __init__(self):
  4. self.hoge = 'huga'
  5.  
  6. def getter(self, arg):
  7. return getattr(self, arg)
  8.  
  9. m = X()
  10. name = 'hoge'
  11. print(m.getter(name))
Success #stdin #stdout 0.02s 9944KB
stdin
Standard input is empty
stdout
huga