开始使用Python调试器pdb

Mat*_*kin 77 python pdb

我想将pdb( Python调试器)添加到我的工具箱中.什么是最好的入门方式?

Mat*_*kin 116

以下是开始使用Python调试器的资源列表:

  1. 阅读Steve Ferb的文章"在Python中调试"
  2. 观看Eric Holscher的截屏视频"使用pdb,Python调试器"
  3. 阅读pdbPython文档 - Python调试器
  4. 阅读第9章 - 当您甚至不知道要记录什么时:使用调试器 - Karen Tracey的Django 1.1测试和调试.

  • 谢谢你的询问.我们想要更多的你马修上SO ;-) (2认同)

Jos*_*ver 15

概要:

# epdb1.py -- experiment with the Python debugger, pdb
import pdb
a = "aaa"
pdb.set_trace()
b = "bbb"
c = "ccc"
final = a + b + c
print final
Run Code Online (Sandbox Code Playgroud)

现在运行你的脚本:

$ python epdb1.py
(Pdb) p a
'aaa'
(Pdb)
Run Code Online (Sandbox Code Playgroud)