$ ls ~yifei/notes/

使用 ipdb 单步调试 Python 代码

Posted on:

Last modified:

pdb 是 Python 标准库中自带的 debugger,ipdb 是基于 ipython 的增强版 pdb。

常用命令

  • [n]ext 下一步
  • [s]tep into 进入函数
  • [r]eturn 跳出函数
  • [b]reakpoint 打断点

pdb

pdb is fine, just don’t have so many features

Usage: import pdb; pdb.set_trace()

Ipdb is better

Usage: import ipdb; ipdb.set_trace() n next p print pp pprint s setp into c continue to next breakpoint b breakpoint a args

还有 pudb

© 2016-2022 Yifei Kong. Powered by ynotes

All contents are under the CC-BY-NC-SA license, if not otherwise specified.

Opinions expressed here are solely my own and do not express the views or opinions of my employer.