How to get module source code by a python 'object' of that module? class TestClass(object): def __init__(self): pass def testMethod(self): print 'abc'
Solution 1:
Instances don't have source code.
Use:
print inspect.getsource(type(ob))
or:
print inspect.getsource(ob.__class__)
Post a Comment for "How To Get Module Source Code By A Python 'object' Of That Module? (not Inspect.getsource)"