gpt4 book ai didi

python - 如何在 pdb 中使用 'debug' 命令(python)

转载 作者:行者123 更新时间:2023-12-05 06:41:17 24 4
gpt4 key购买 nike

我想知道如何在pdb中使用debug命令?

(Pdb) help

Documented commands (type help <topic>):
========================================
EOF c d h list q rv undisplay
a cl debug help ll quit s unt
alias clear disable ignore longlist r source until
args commands display interact n restart step up
b condition down j next return tbreak w
break cont enable jump p retval u whatis
bt continue exit l pp run unalias where

Miscellaneous help topics:
==========================
pdb exec
(Pdb) help debug
debug code
Enter a recursive debugger that steps through the code
argument (which is an arbitrary expression or statement to be
executed in the current environment).
(Pdb) debug print('hello')
ENTERING RECURSIVE DEBUGGER
> <string>(1)<module>()->None
((Pdb)) n
hello
--Return--
> <string>(1)<module>()->None
((Pdb)) n
LEAVING RECURSIVE DEBUGGER
(Pdb)

最佳答案

这个问题让我困惑了很多年。我总是忘记搜索最终答案。但今天我明白了,并在这里分享我的发现。

How can I debug manually typed expression and statements in pdb?

当您第一次进入递归 Debug模式时,输入 s ,您将知道接下来要做什么。

关于python - 如何在 pdb 中使用 'debug' 命令(python),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40900987/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com