Say I have code the following code:
for i in range(100):
print i
In general I can add one line to the code as:
for i in range(100):
import ipdb;ipdb.set_trace()
print i
However, now I want to debug it at condition of i == 10
, and I don't want to bother by typing c
for 10 times in ipdb, how should I do?
In the documentation I found condition bpnumber [condition]
, but how could I know the bpnumber
if there is no list of bpnumber
index. The documentation also says b(reak) ([file:]lineno | function) [, condition]
. For example, assume the line number of print i
is xx
. I entered the following in ipdb shell: b xx, i == 10
but nothing as expected happened.