【python】命令行调试代码

every blog every motto: You can do more than you think.
https://blog.csdn.net/weixin_39190382?type=blog

0. 前言

python 命令行调试代码

1. 正文

命令行调试代码

python -m  pdb test.py

1.1 常用命令

  • next:单步跳过
  • step:单步进
  • c: 继续执⾏
  • w: 显⽰当前正在执⾏的代码⾏的上下⽂信息 a: 打印当前函数的参数列表
    s: 执⾏当前代码⾏,并停在第⼀个能停的地⽅(相当于单步进⼊)
    n: 继续执⾏到当前函数的下⼀⾏,或者当前⾏直接返回(单步跳过)

1.2 代码实现断点

import pdb
def test():
    pdb.set_trace()
    return "test"
print(test())

参考

[1] https://blog.csdn.net/weixin_48629412/article/details/108822562

猜你喜欢

转载自blog.csdn.net/weixin_39190382/article/details/128920515
今日推荐