Can you jump to the nth iteration in a loop?

前端 未结 2 1857
傲寒
傲寒 2021-01-15 04:51
42 -> for i in range(n):
43       foo(i)

Here I am, in the middle of a pdb session. I want to jump to the loop iteration with i = k

2条回答
  •  深忆病人
    2021-01-15 04:58

    I can't test this right now, but I believe that you can use the condition command:

    condition bpnumber [condition]
    Condition is an expression which must evaluate to true before the breakpoint is honored. If condition is absent, any existing condition is removed; i.e., the breakpoint is made unconditional.

    condition i == k

提交回复
热议问题