How to execute multi-line statements within Python's own debugger (PDB)

后端 未结 6 1241
南旧
南旧 2020-12-07 07:06

So I am running a Python script within which I am calling Python\'s debugger, PDB by writing:

import ipdb; ipdb.set_trace()

(iPython\'s ver

6条回答
  •  被撕碎了的回忆
    2020-12-07 07:32

    Inside the Python (2.7.1) interpreter or debugger (import pdb), you can execute a multi-line statement with the following syntax.

    for i in range(5): print("Hello"); print("World"); print(i)
    

    Note: When I'm inside the interpreter, I have to hit return twice before the code will execute. Inside the debugger, however, I only have to hit return once.

提交回复
热议问题