簡體   English   中英

python pdb 如何繼續下 x 個循環

[英]python pdb how to continue for the next x number of loops

我需要在 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
    ...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM