来自 PDB
(Pdb) help l
l(ist) [first [,last]]
List source code for the current file.
Without arguments, list 11 lines around the current line
or continue the previous listing.
With one argument, list 11 lines starting at that line.
With two arguments, list the given range;
if the second argument is less than the first, it is a count.
“继续上一个listing”功能确实不错,但是怎么关掉呢?
最佳答案
晚了,但希望仍然有用。在 pdb 中,创建以下别名(您可以将其添加到 .pdbrc 文件中,使其始终可用):
alias ll u;;d;;l
然后每当你输入 ll
时,pdb 就会从当前位置开始列出。它通过向上堆栈然后向下堆栈来工作,这会将'l'重置为从当前位置显示。 (如果您位于堆栈跟踪的顶部,这将不起作用。)
关于python - 在 pdb 中,如何重置列表 (l) 命令行计数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1318676/