我有一个不能碰的密码-
def main():
sandbox()
def game_over():
print("I sense a disturbance in the code")
os._exit(1)
print('The code is strong in this one')
def win():
# TODO fail_if_not_called_from_line_8()
print(LOGO)
game_over()
win()
但是,我可以用sandbox()方法编写代码。问题是,我需要的程序输出读取'的代码是在这一个强大的'连同标志在下一个方法。这就是我现在在sandbox()中的内容。你知道吗
def sandbox():
import pdb
frame = inspect.currentframe()
try:
finally:
del frame
我在考虑使用inspector获取gameover()方法的信息,然后以某种方式使用settrace。不幸的是,我对Python 100%陌生,只接触过Java和C。就我的一生而言,我无法用我有限的Python知识来解决这个问题。任何帮助都将不胜感激。你知道吗
如果这是一个简单的解决方案,我很抱歉
目前没有回答
相关问题 更多 >
编程相关推荐