- Mastering Python Scripting for System Administrators
- Ganesh Sanjiv Naik
- 128字
- 2021-07-02 14:00:32
The pdb debugger
The pdb module is used to debug Python programs. Python programs use pdb interactive source code debugger to debug the programs. pdb sets breakpoints and inspects the stack frames, and lists the source code.
Now we will learn about how we can use the pdb debugger. There are three ways to use this debugger:
- Within an interpreter
- From a command line
- Within a Python script
We are going to create a pdb_example.py script and add the following content in that script:
class Student:
def __init__(self, std):
self.count = std
def print_std(self):
for i in range(self.count):
print(i)
return
if __name__ == '__main__':
Student(5).print_std()
Using this script as an example to learn Python debugging, we will see how we can start the debugger in detail.
推薦閱讀
- Mastering Concurrency Programming with Java 8
- Visual C++程序設(shè)計(jì)學(xué)習(xí)筆記
- SQL學(xué)習(xí)指南(第3版)
- Mastering JavaScript Design Patterns(Second Edition)
- 計(jì)算語(yǔ)言學(xué)導(dǎo)論
- Microsoft Exchange Server 2016 PowerShell Cookbook(Fourth Edition)
- Spring Boot從入門到實(shí)戰(zhàn)
- AngularJS UI Development
- SQL Server 2014 Development Essentials
- Serverless工程實(shí)踐:從入門到進(jìn)階
- Computer Vision with Python 3
- Web前端開(kāi)發(fā)實(shí)戰(zhàn)教程(HTML5+CSS3+JavaScript)(微課版)
- Sony Vegas Pro 11 Beginner’s Guide
- Django 3 Web應(yīng)用開(kāi)發(fā)從零開(kāi)始學(xué)(視頻教學(xué)版)
- Getting Started with SpriteKit