Enter Interactive Mode In Python

后端 未结 7 820
日久生厌
日久生厌 2021-01-30 06:42

I\'m running my Python program and have a point where it would be useful to jump in and see what\'s going on, and then step out again. Sort of like a temporary console mode.

7条回答
  •  一个人的身影
    2021-01-30 07:07

    You can use ipdb.

    To set your breakpoints, add import ipdb; ipdb.set_trace() where you want to jump into the debugger. Once you reach a breakpoint, you’ll be given an interactive shell and a few lines of code around your breakpoint for context.

    https://www.safaribooksonline.com/blog/2014/11/18/intro-python-debugger/

提交回复
热议问题