Use p variable to print in debugger

Can we use “p variable” to print a variable in the debugger? So we don’t have to type out “print(myvar)”.

Is that possible?

Isn’t that how it already works? pdb — The Python Debugger — Python 3.12.2 documentation

1 Like

Is this from within Python, or from within a debugger? If a debugger, which one?

If within Python, you can use p = print, followed by p(myvar) wherever you want to print something.

It’s the normal Python debugger pdb.

And I swear it didn’t work yesterday. Now it works today. Sorry for the extra post.