import inspect
deffunCase():
a =1
b =1print("OK")
funCase2()deffunCase2():print("cc")classclassCase(object):def__init__(self):
self.start =1deffun(self):print("sd")
funCaseResult = inspect.getsource(funCase)
funCase2Result = inspect.getsource(funCase2)
classCaseResult = inspect.getsource(classCase)print("----------funCaseResult------------")print(funCaseResult)print("----------funCase2Result------------")print(funCase2Result)print("----------classCaseResult------------")print(classCaseResult)
----------funCaseResult------------deffunCase():
a =1
b =1print("OK")
funCase2()----------funCase2Result------------deffunCase2():print("cc")----------classCaseResult------------classclassCase(object):def__init__(self):
self.start =1deffun(self):print("sd")
Process finished with exit code 0