我需要在python中调试一个for循环,但是在出现错误之前,它需要继续进行多次迭代。
现在我每次都可以在pdb中按'c'前进到下一个迭代,但是我想知道,有没有办法说'c 20'并使其在停止之前继续下一个20个循环?
感谢
首先,请参阅pdb
文档。如果失败,请插入一个计数器:
count = 0
while cond: # your current loop
...
count += 1
if count > 20:
count = 25
# Put a breakpoint here.
# When you reach this point, insert any other debugging you want.
# Code you want to trace
...