1. Installation
Pip Install ipdb
1. function
Python-m ipdb xxx.py
Inside the program:
From ipdb Import
Set_trace Set_trace ()
3. Common commands
ENTER
(Repeat Last command)
c
Continue to
l
(Find where it is currently located)
s
(Go to subroutine)
r
(run until subroutine ends)
!<python 命令>
h
Help
- A (RGS) prints the parameters of the current function
- J (UMP) lets the program jump to the specified number of rows
- L (IST) can list code blocks that are currently going to run
- N (EXT) lets the program run the next line, if the current statement has a function call, n is not entered in the called function body
- P (rint) One of the most useful commands to print a variable
- Q (uit) exit debug
- R (Eturn) continues execution until the function body returns
- S (TEP) is similar to n, but if there is currently a function call, then s will enter the body of the called function
Debugging Python with Ipdb