import inspect
def funCase():
a = 1
b = 1
print("OK")
funCase2()
def funCase2():
print("cc")
class classCase(object):
def __init__(self):
self.start = 1
def fun(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------------
def funCase():
a = 1
b = 1
print("OK")
funCase2()
----------funCase2Result------------
def funCase2():
print("cc")
----------classCaseResult------------
class classCase(object):
def __init__(self):
self.start = 1
def fun(self):
print("sd")
Process finished with exit code 0