You can use the b
command, followed by the module name and line number, to set a breakpoint:
$ b util:5
This will set a breakpoint on line 5 of the util
module. If we supply no module name, then pdb
will set a breakpoint in the current module we’re running.
Running b
with no line number will display a list of all our current breakpoints, which we can toggle on and off or clear. The c
command will continue execution up until the next breakpoint is hit. a
will show us the arguments passed into a function.
We can also create conditional breakpoints, which are breakpoints that only hit when a certain condition is met. In this example, you create a breakpoint that only hits if the argument passed to get_path()
does not start with a /
:
Amitoz on March 16, 2020
Hello, Is there any way to download the files? example[1-5].py ?