100 Days Of Python - Day 13
Day 13
Debugging
- Debugging is the process of finding and fixing errors in code.
- The
Pythondebugger ispdb. pdbis a module that is built intoPython.- It can be used to set breakpoints in code and step through the code line by line.
pdbcan be used in the terminal or inPyCharm.- To use
pdbin the terminal, use thepython3 -m pdbcommand followed by the name of the file you want to debug.
Steps in debugging
- Reproduce the bug.
- Find the source of the bug.
- Fix the bug.
- Test the fix.
- Repeat steps 1-4 until the bug is fixed.
- Use
print()statements to help you find the source of the bug.
This post is licensed under CC BY 4.0 by the author.