Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pprint and ipdb in IPython notebook

I am trying to learn how to use the ipdb debugger. I inserted a breakpoint and by entering continue I advance from one breakpoint to another. If I want to print the value of the variable a while I am half way in the execution between the two breakpoints, how can I do this with ipdb/pdb? I tried print and pprint but nothing showed up. enter image description here

like image 287
ROBOTPWNS Avatar asked Dec 14 '22 19:12

ROBOTPWNS


1 Answers

You can use p or pp in IPDB console.

From pdb documentation:

p expression

Evaluate the expression in the current context and print its value.

pp expression

Like the p command, except the value of the expression is pretty-printed using the pprint module

like image 57
Mr.Teapot Avatar answered Dec 26 '22 19:12

Mr.Teapot