正在运行 !import code; code.interact(local=vars())
在pdb
里面prompt 允许您在调试器中输入多行语句(例如类定义)(source)。 有什么方法可以避免每次都复制粘贴/键入整行?
我在想Conque
对于 vim
并设置类似 :noremap ,d i!import code; code.interact(local=vars())<Esc>
的内容但在插入模式之外编辑任何内容似乎对提示没有任何影响。
最佳答案
PDB 在启动时读取 .pdbrc
。来自Python docs :
If a file .pdbrc exists in the user’s home directory or in the current directory, it is read in and executed as if it had been typed at the debugger prompt. This is particularly useful for aliases. If both files exist, the one in the home directory is read first and aliases defined there can be overridden by the local file.
因此请尝试创建该文件并将该命令按原样放入其中。
关于python - 方便地在 Python 的调试器(pdb)中启用多行语句的执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15078087/