Python 调试器 pdb 入门
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4228637/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 14:50:11 来源:igfitidea点击:
Getting started with the Python debugger, pdb
提问by Matthew Rankin
采纳答案by Matthew Rankin
Here's a list of resources to get started with the Python debugger:
以下是开始使用 Python 调试器的资源列表:
- Read Steve Ferb's article "Debugging in Python"
- Watch Eric Holscher's screencast "Using pdb, the Python Debugger"
- Read the Python documentation for pdb — The Python Debugger
- Read Chapter 9—When You Don't Even Know What to Log: Using Debuggers—of Karen Tracey's Django 1.1 Testing and Debugging.
- 阅读 Steve Ferb 的文章“在 Python 中调试”
- 观看 Eric Holscher 的截屏视频“使用 pdb,Python 调试器”
- 阅读pdb的Python 文档 — Python 调试器
- 阅读 Karen Tracey 的Django 1.1 测试和调试的第 9 章 — 当您甚至不知道要记录什么时:使用调试器。
回答by Josh Glover
Synopsis:
概要:
# 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
Now run your script:
现在运行你的脚本:
$ python epdb1.py
(Pdb) p a
'aaa'
(Pdb)

