Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在使用调试时打开交互式控制台后
code.interact(local=locals())
如何恢复代码执行。我已经检查了“代码”模块和搜索堆栈溢出的文档,但找不到任何东西。
这与退出任何 Python 解释器会话的方式相同:发送文件结尾字符。
那是Ctrl-D在 Linux 上或Ctrl-Z在 Windows 上输入。
If like me you always forget to hit Ctrl-D, you can wrap up your prompt in a try/except block:
try: code.interact(local=locals()) except SystemExit: pass