Python Debugger Cheatsheet

Just the most important commands. For a nice, detailed description read this tutorial.

Entry / Exit

Command Description
breakpoint() start debugging here
q quit pdb


Command Description
p <var> print value of object
pp <var> pretty print object
l listing eleven lines around current
ll show long listing of code
a print arguments of current function
display <var> display value of expression during any change
undisplay stop displaying all expressions
w print stacktrace (where)
h <cmd> show help for pdb command
Command Description
n next step, with staying local
s step, with stepping into foreign function
c continue code execution until next breakpoint
cl clear