如何从Python源代码进入调试器?

发布于 2024-07-06 00:56:26 字数 43 浏览 13 评论 0原文

你在Python源代码中插入什么来让它进入pdb(当执行到那个位置时)?

What do you insert into Python source code to have it break into pdb (when execution gets to that spot)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

酒与心事 2024-07-13 00:56:26
import pdb; pdb.set_trace()

See Python: Coding in the Debugger for Beginners for this and more helpful hints.

記憶穿過時間隧道 2024-07-13 00:56:26

从 Python 3.7 开始,您可以使用 breakpoint() - https://docs.python.org/3/library/functions.html#breakpoint

As of Python 3.7, you can use breakpoint() - https://docs.python.org/3/library/functions.html#breakpoint

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文