如果要编写调试器,则需要大量使用该inspect
模块:
def show_callers_locals():
"""Print the local variables in the caller's frame."""
import inspect
frame = inspect.currentframe()
try:
print(frame.f_back.f_locals)
finally:
del frame
从Python中调用名称空间获取本地人
如果要编写调试器,则需要大量使用该inspect
模块:
def show_callers_locals():
"""Print the local variables in the caller's frame."""
import inspect
frame = inspect.currentframe()
try:
print(frame.f_back.f_locals)
finally:
del frame