python pdb_调试代码

import pdb

def pdb_run(args):  # 4
    for i in range(args):  # [0,1,2,3]
        pdb.set_trace()
        print(i)

    return  args  # 4

pdb.run("pdb_run(4)")

这里写图片描述

开始调试:直接运行脚本,会停留在 pdb.set_trace() 处,选择 n+enter 可以执行当前的 statement。在第一次按下了 n+enter 之后可以直接按 enter 表示重复执行上一条 debug 命令。

猜你喜欢

转载自blog.csdn.net/zcx1203/article/details/82390788