ROBOTPWNS
ROBOTPWNS

Reputation: 4419

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

Upvotes: 5

Views: 2951

Answers (1)

Mr.Teapot
Mr.Teapot

Reputation: 141

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

Upvotes: 14

Related Questions